Add test covering imported target scope rules
This commit is contained in:
parent
ca39c5cdd1
commit
f9c1c6225c
|
@ -16,3 +16,5 @@ add_CMakeOnly_test(CheckSymbolExists)
|
|||
add_CMakeOnly_test(CheckCXXSymbolExists)
|
||||
|
||||
add_CMakeOnly_test(AllFindModules)
|
||||
|
||||
add_CMakeOnly_test(TargetScope)
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
cmake_minimum_required (VERSION 2.8)
|
||||
project(TargetScope NONE)
|
||||
|
||||
add_subdirectory(Sub)
|
||||
|
||||
if(TARGET SubLibLocal)
|
||||
message(FATAL_ERROR "SubLibLocal visible in top directory")
|
||||
endif()
|
||||
if(NOT TARGET SubLibGlobal)
|
||||
message(FATAL_ERROR "SubLibGlobal not visible in top directory")
|
||||
endif()
|
||||
|
||||
add_subdirectory(Sib)
|
|
@ -0,0 +1,6 @@
|
|||
if(TARGET SubLibLocal)
|
||||
message(FATAL_ERROR "SubLibLocal visible in sibling directory")
|
||||
endif()
|
||||
if(NOT TARGET SubLibGlobal)
|
||||
message(FATAL_ERROR "SubLibGlobal not visible in sibling directory")
|
||||
endif()
|
|
@ -0,0 +1,9 @@
|
|||
add_library(SubLibLocal UNKNOWN IMPORTED)
|
||||
add_library(SubLibGlobal UNKNOWN IMPORTED GLOBAL)
|
||||
add_subdirectory(Sub)
|
||||
if(NOT TARGET SubLibLocal)
|
||||
message(FATAL_ERROR "SubLibLocal not visible in own directory")
|
||||
endif()
|
||||
if(NOT TARGET SubLibGlobal)
|
||||
message(FATAL_ERROR "SubLibGlobal not visible in own directory")
|
||||
endif()
|
|
@ -0,0 +1,6 @@
|
|||
if(NOT TARGET SubLibLocal)
|
||||
message(FATAL_ERROR "SubLibLocal not visible in subdirectory")
|
||||
endif()
|
||||
if(NOT TARGET SubLibGlobal)
|
||||
message(FATAL_ERROR "SubLibGlobal not visible in subdirectory")
|
||||
endif()
|
Loading…
Reference in New Issue