diff options
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in | 22 | ||||
-rw-r--r-- | Tests/CheckFortran.cmake | 7 | ||||
-rw-r--r-- | Tests/RunCMake/get_property/target_properties-stderr.txt | 8 | ||||
-rw-r--r-- | Tests/RunCMake/get_property/target_properties.cmake | 7 | ||||
-rw-r--r-- | Tests/RunCMake/set_property/IMPORTED_GLOBAL-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/set_property/IMPORTED_GLOBAL-stderr.txt | 61 | ||||
-rw-r--r-- | Tests/RunCMake/set_property/IMPORTED_GLOBAL-stdout.txt | 17 | ||||
-rw-r--r-- | Tests/RunCMake/set_property/IMPORTED_GLOBAL.cmake | 53 | ||||
-rw-r--r-- | Tests/RunCMake/set_property/IMPORTED_GLOBAL/CMakeLists.txt | 8 | ||||
-rw-r--r-- | Tests/RunCMake/set_property/RunCMakeTest.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/set_property/test.cpp | 0 |
11 files changed, 183 insertions, 2 deletions
diff --git a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in index d7d881e..65487bb 100644 --- a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in +++ b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in @@ -525,6 +525,27 @@ set(msys_g77_dirs "C:/some-mingw/lib/gcc/mingw32/3.4.5;C:/some-mingw/lib/gcc;/so list(APPEND platforms msys_g77) #----------------------------------------------------------------------------- +# MSYS2 + +# gcc dummy.c -v +set(msys2_gcc_text " C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/collect2.exe -plugin C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/liblto_plugin-0.dll -plugin-opt=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/lto-wrapper.exe -plugin-opt=-fresolution=C:/msys64/tmp/ccikz9Wf.res -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_eh -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-lpthread -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_eh -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -m i386pep -Bdynamic C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/crtbegin.o -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0 -LC:/msys64/mingw64/bin/../lib/gcc -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib/../lib -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../lib -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../.. C:/msys64/tmp/ccK0dTUv.o -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib/../lib/default-manifest.o C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/crtend.o") +set(msys2_gcc_libs "mingw32;gcc;moldname;mingwex;pthread;advapi32;shell32;user32;kernel32;mingw32;gcc;moldname;mingwex") +set(msys2_gcc_dirs "C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0;C:/msys64/mingw64/lib/gcc;C:/msys64/mingw64/x86_64-w64-mingw32/lib;C:/msys64/mingw64/lib") +list(APPEND platforms msys2_gcc) + +# g++ dummy.cxx -v +set(msys2_g++_text " C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/collect2.exe -plugin C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/liblto_plugin-0.dll -plugin-opt=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/lto-wrapper.exe -plugin-opt=-fresolution=C:/msys64/tmp/ccJQgvbN.res -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-lpthread -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -m i386pep -Bdynamic C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/crtbegin.o -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0 -LC:/msys64/mingw64/bin/../lib/gcc -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib/../lib -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../lib -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../.. C:/msys64/tmp/ccqPpuVS.o -lstdc++ -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib/../lib/default-manifest.o C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/crtend.o") +set(msys2_g++_libs "stdc++;mingw32;gcc_s;gcc;moldname;mingwex;pthread;advapi32;shell32;user32;kernel32;mingw32;gcc_s;gcc;moldname;mingwex") +set(msys2_g++_dirs "C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0;C:/msys64/mingw64/lib/gcc;C:/msys64/mingw64/x86_64-w64-mingw32/lib;C:/msys64/mingw64/lib") +list(APPEND platforms msys2_g++) + +# gfortran dummy.f90 -v +set(msys2_gfortran_text " C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/collect2.exe -plugin C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/liblto_plugin-0.dll -plugin-opt=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/lto-wrapper.exe -plugin-opt=-fresolution=C:/msys64/tmp/cczOKIDy.res -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-lquadmath -plugin-opt=-pass-through=-lm -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-lpthread -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -m i386pep -Bdynamic C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/crtbegin.o -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0 -LC:/msys64/mingw64/bin/../lib/gcc -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib/../lib -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../lib -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../.. C:/msys64/tmp/ccyXuCgD.o -lgfortran -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -lquadmath -lm -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib/../lib/default-manifest.o C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/crtend.o") +set(msys2_gfortran_libs "gfortran;mingw32;gcc_s;gcc;moldname;mingwex;quadmath;m;mingw32;gcc_s;gcc;moldname;mingwex;pthread;advapi32;shell32;user32;kernel32;mingw32;gcc_s;gcc;moldname;mingwex") +set(msys2_gfortran_dirs "C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0;C:/msys64/mingw64/lib/gcc;C:/msys64/mingw64/x86_64-w64-mingw32/lib;C:/msys64/mingw64/lib") +list(APPEND platforms msys2_gfortran) + +#----------------------------------------------------------------------------- # MSVC from NVIDIA CUDA set(nvcc_msvc_text [[cuda-fake-ld cl.exe -nologo "tmp/a_dlink.obj" "tmp/CMakeCUDACompilerId.obj" -link -INCREMENTAL:NO "/LIBPATH:C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0/bin/../lib/x64" cudadevrt.lib cudart_static.lib -Fe"a.exe"]]) @@ -532,7 +553,6 @@ set(nvcc_msvc_libs "cudadevrt.lib;cudart_static.lib") set(nvcc_msvc_dirs "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0/lib/x64") list(APPEND platforms nvcc_msvc) - #----------------------------------------------------------------------------- # PGI on Windows diff --git a/Tests/CheckFortran.cmake b/Tests/CheckFortran.cmake index b1652ba..16a8ed2 100644 --- a/Tests/CheckFortran.cmake +++ b/Tests/CheckFortran.cmake @@ -15,11 +15,18 @@ file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\" \"set(CMAKE_Fortran_COMPILER_SUPPORTS_F90 \\\"\${CMAKE_Fortran_COMPILER_SUPPORTS_F90}\\\")\\n\" ) ") + if(CMAKE_GENERATOR_INSTANCE) + set(_D_CMAKE_GENERATOR_INSTANCE "-DCMAKE_GENERATOR_INSTANCE:INTERNAL=${CMAKE_GENERATOR_INSTANCE}") + else() + set(_D_CMAKE_GENERATOR_INSTANCE "") + endif() execute_process( WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CheckFortran COMMAND ${CMAKE_COMMAND} . -G ${CMAKE_GENERATOR} -A "${CMAKE_GENERATOR_PLATFORM}" -T "${CMAKE_GENERATOR_TOOLSET}" + ${_D_CMAKE_GENERATOR_INSTANCE} + TIMEOUT 60 OUTPUT_VARIABLE output ERROR_VARIABLE output RESULT_VARIABLE result diff --git a/Tests/RunCMake/get_property/target_properties-stderr.txt b/Tests/RunCMake/get_property/target_properties-stderr.txt index 6b3c6ca..df7a2f1 100644 --- a/Tests/RunCMake/get_property/target_properties-stderr.txt +++ b/Tests/RunCMake/get_property/target_properties-stderr.txt @@ -7,4 +7,10 @@ get_property: --><-- get_target_property: -->(.*)/Tests/RunCMake/get_property<-- get_property: -->(.*)/Tests/RunCMake/get_property<-- get_target_property: -->(.*)/Tests/RunCMake/get_property/target_properties-build<-- -get_property: -->(.*)/Tests/RunCMake/get_property/target_properties-build<--$ +get_property: -->(.*)/Tests/RunCMake/get_property/target_properties-build<-- +get_target_property: -->FALSE<-- +get_property: -->FALSE<-- +get_target_property: -->FALSE<-- +get_property: -->FALSE<-- +get_target_property: -->TRUE<-- +get_property: -->TRUE<--$ diff --git a/Tests/RunCMake/get_property/target_properties.cmake b/Tests/RunCMake/get_property/target_properties.cmake index 9ff833a..321d5b5 100644 --- a/Tests/RunCMake/get_property/target_properties.cmake +++ b/Tests/RunCMake/get_property/target_properties.cmake @@ -16,3 +16,10 @@ check_target_property(tgt custom) check_target_property(tgt noexist) check_target_property(tgt SOURCE_DIR) check_target_property(tgt BINARY_DIR) + +add_library(imported_local_tgt SHARED IMPORTED) +add_library(imported_global_tgt SHARED IMPORTED GLOBAL) + +check_target_property(tgt IMPORTED_GLOBAL) +check_target_property(imported_local_tgt IMPORTED_GLOBAL) +check_target_property(imported_global_tgt IMPORTED_GLOBAL) diff --git a/Tests/RunCMake/set_property/IMPORTED_GLOBAL-result.txt b/Tests/RunCMake/set_property/IMPORTED_GLOBAL-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/set_property/IMPORTED_GLOBAL-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/set_property/IMPORTED_GLOBAL-stderr.txt b/Tests/RunCMake/set_property/IMPORTED_GLOBAL-stderr.txt new file mode 100644 index 0000000..f21b1de --- /dev/null +++ b/Tests/RunCMake/set_property/IMPORTED_GLOBAL-stderr.txt @@ -0,0 +1,61 @@ +^CMake Error at IMPORTED_GLOBAL.cmake:9 \(set_property\): + IMPORTED_GLOBAL property can't be set to FALSE on targets + \(\"ImportedGlobalTarget\"\) + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Error at IMPORTED_GLOBAL.cmake:16 \(set_property\): + IMPORTED_GLOBAL property can't be appended, only set on imported targets + \(\"ImportedGlobalTarget\"\) + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Error at IMPORTED_GLOBAL.cmake:26 \(set_property\): + IMPORTED_GLOBAL property can't be set to FALSE on targets + \(\"ImportedLocalTarget\"\) + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Error at IMPORTED_GLOBAL.cmake:32 \(set_property\): + IMPORTED_GLOBAL property can't be set on non-imported targets + \(\"NonImportedTarget\"\) + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Error at IMPORTED_GLOBAL/CMakeLists.txt:8 \(set_property\): + Attempt to promote imported target \"ImportedLocalTarget2\" to global scope + \(by setting IMPORTED_GLOBAL\) which is not built in this directory. + + +CMake Error in IMPORTED_GLOBAL/CMakeLists.txt: + IMPORTED_GLOBAL property can't be set to FALSE on targets + \(\"ImportedSubdirTarget1\"\) + + + +CMake Error at IMPORTED_GLOBAL.cmake:50 \(set_property\): + Attempt to promote imported target \"ImportedSubdirTarget1\" to global scope + \(by setting IMPORTED_GLOBAL\) which is not built in this directory. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Error in IMPORTED_GLOBAL/CMakeLists.txt: + IMPORTED_GLOBAL property can't be set to FALSE on targets + \(\"ImportedSubdirTarget2\"\) + + + +CMake Error at IMPORTED_GLOBAL.cmake:52 \(set_property\): + Attempt to promote imported target \"ImportedSubdirTarget2\" to global scope + \(by setting IMPORTED_GLOBAL\) which is not built in this directory. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/set_property/IMPORTED_GLOBAL-stdout.txt b/Tests/RunCMake/set_property/IMPORTED_GLOBAL-stdout.txt new file mode 100644 index 0000000..c5f1d11 --- /dev/null +++ b/Tests/RunCMake/set_property/IMPORTED_GLOBAL-stdout.txt @@ -0,0 +1,17 @@ +-- ImportedGlobalTarget: Target IMPORTED_GLOBAL is 'TRUE' +-- ImportedGlobalTarget: Target IMPORTED_GLOBAL is 'TRUE' +-- ImportedGlobalTarget: Target IMPORTED_GLOBAL is 'TRUE' +-- ImportedGlobalTarget: Target IMPORTED_GLOBAL is 'TRUE' +-- ImportedGlobalTarget: Target IMPORTED_GLOBAL is 'TRUE' +-- ImportedLocalTarget: Target IMPORTED_GLOBAL is 'FALSE' +-- ImportedLocalTarget: Target IMPORTED_GLOBAL is 'TRUE' +-- ImportedLocalTarget: Target IMPORTED_GLOBAL is 'TRUE' +-- ImportedLocalTarget: Target IMPORTED_GLOBAL is 'TRUE' +-- NonImportedTarget: Target IMPORTED_GLOBAL is 'FALSE' +-- NonImportedTarget: Target IMPORTED_GLOBAL is 'FALSE' +-- ImportedLocalTarget2: Target IMPORTED_GLOBAL is 'FALSE' +-- ImportedLocalTarget2: Target IMPORTED_GLOBAL is 'TRUE' +-- ImportedSubdirTarget1: Target IMPORTED_GLOBAL is 'TRUE' +-- ImportedSubdirTarget2: Target IMPORTED_GLOBAL is 'TRUE' +-- ImportedSubdirTarget1: Target IMPORTED_GLOBAL is 'TRUE' +-- ImportedSubdirTarget2: Target IMPORTED_GLOBAL is 'TRUE' diff --git a/Tests/RunCMake/set_property/IMPORTED_GLOBAL.cmake b/Tests/RunCMake/set_property/IMPORTED_GLOBAL.cmake new file mode 100644 index 0000000..08308eb --- /dev/null +++ b/Tests/RunCMake/set_property/IMPORTED_GLOBAL.cmake @@ -0,0 +1,53 @@ +macro(print_property TARGET PROP) + get_property(val TARGET ${TARGET} PROPERTY ${PROP}) + message(STATUS "${TARGET}: Target ${PROP} is '${val}'") +endmacro() + +# Changing property on IMPORTED target created with `GLOBAL` option. +add_library(ImportedGlobalTarget SHARED IMPORTED GLOBAL) +print_property(ImportedGlobalTarget IMPORTED_GLOBAL) +set_property(TARGET ImportedGlobalTarget PROPERTY IMPORTED_GLOBAL FALSE) +print_property(ImportedGlobalTarget IMPORTED_GLOBAL) +set_property(TARGET ImportedGlobalTarget PROPERTY IMPORTED_GLOBAL TRUE) +print_property(ImportedGlobalTarget IMPORTED_GLOBAL) +set_property(TARGET ImportedGlobalTarget PROPERTY IMPORTED_GLOBAL TRUE) +print_property(ImportedGlobalTarget IMPORTED_GLOBAL) +# Appending property is never allowed! +set_property(TARGET ImportedGlobalTarget APPEND PROPERTY IMPORTED_GLOBAL TRUE) +print_property(ImportedGlobalTarget IMPORTED_GLOBAL) + +# Changing property on IMPORTED target created without `GLOBAL` option. +add_library(ImportedLocalTarget SHARED IMPORTED) +print_property(ImportedLocalTarget IMPORTED_GLOBAL) +set_property(TARGET ImportedLocalTarget PROPERTY IMPORTED_GLOBAL TRUE) +print_property(ImportedLocalTarget IMPORTED_GLOBAL) +set_property(TARGET ImportedLocalTarget PROPERTY IMPORTED_GLOBAL TRUE) +print_property(ImportedLocalTarget IMPORTED_GLOBAL) +set_property(TARGET ImportedLocalTarget PROPERTY IMPORTED_GLOBAL FALSE) +print_property(ImportedLocalTarget IMPORTED_GLOBAL) + +# Setting property on non-IMPORTED target is never allowed! +add_library(NonImportedTarget SHARED test.cpp) +print_property(NonImportedTarget IMPORTED_GLOBAL) +set_property(TARGET NonImportedTarget PROPERTY IMPORTED_GLOBAL TRUE) +print_property(NonImportedTarget IMPORTED_GLOBAL) + +# Local IMPORTED targets can only be promoted from same directory! +add_library(ImportedLocalTarget2 SHARED IMPORTED) +print_property(ImportedLocalTarget2 IMPORTED_GLOBAL) +add_subdirectory(IMPORTED_GLOBAL) +# Note: The value should not have changed. However, it does change because the +# check for the same directory comes after it was changed! (At least, that is +# not really bad because the generation will fail due to this error.) +print_property(ImportedLocalTarget2 IMPORTED_GLOBAL) + +# Global IMPORTED targets from subdir are always visible +# no matter how they became global. +print_property(ImportedSubdirTarget1 IMPORTED_GLOBAL) +print_property(ImportedSubdirTarget2 IMPORTED_GLOBAL) + +# Changing property on IMPORTED target from subdir is never possible. +set_property(TARGET ImportedSubdirTarget1 PROPERTY IMPORTED_GLOBAL FALSE) +print_property(ImportedSubdirTarget1 IMPORTED_GLOBAL) +set_property(TARGET ImportedSubdirTarget2 PROPERTY IMPORTED_GLOBAL FALSE) +print_property(ImportedSubdirTarget2 IMPORTED_GLOBAL) diff --git a/Tests/RunCMake/set_property/IMPORTED_GLOBAL/CMakeLists.txt b/Tests/RunCMake/set_property/IMPORTED_GLOBAL/CMakeLists.txt new file mode 100644 index 0000000..468bf78 --- /dev/null +++ b/Tests/RunCMake/set_property/IMPORTED_GLOBAL/CMakeLists.txt @@ -0,0 +1,8 @@ +add_library(ImportedSubdirTarget1 SHARED IMPORTED GLOBAL) +add_library(ImportedSubdirTarget2 SHARED IMPORTED) + +# Extend visibility of ImportedSubdirTarget2 to global scope. +set_property(TARGET ImportedSubdirTarget2 PROPERTY IMPORTED_GLOBAL TRUE) + +# Only targets from the same directory can be promoted. +set_property(TARGET ImportedLocalTarget2 PROPERTY IMPORTED_GLOBAL TRUE) diff --git a/Tests/RunCMake/set_property/RunCMakeTest.cmake b/Tests/RunCMake/set_property/RunCMakeTest.cmake index 1ddacee..5b5327d 100644 --- a/Tests/RunCMake/set_property/RunCMakeTest.cmake +++ b/Tests/RunCMake/set_property/RunCMakeTest.cmake @@ -3,6 +3,7 @@ include(RunCMake) run_cmake(COMPILE_DEFINITIONS) run_cmake(COMPILE_FEATURES) run_cmake(COMPILE_OPTIONS) +run_cmake(IMPORTED_GLOBAL) run_cmake(INCLUDE_DIRECTORIES) run_cmake(LINK_LIBRARIES) run_cmake(SOURCES) diff --git a/Tests/RunCMake/set_property/test.cpp b/Tests/RunCMake/set_property/test.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/set_property/test.cpp |