diff options
Diffstat (limited to 'Tests')
101 files changed, 735 insertions, 144 deletions
diff --git a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt index 35dd276..1dedbae 100644 --- a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt +++ b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt @@ -23,18 +23,19 @@ add_executable(consumer "${CMAKE_CURRENT_SOURCE_DIR}/consumer.cpp" ) -if (NOT CMAKE_GENERATOR MATCHES "Visual Studio") - target_sources(consumer PRIVATE - "${CMAKE_CURRENT_SOURCE_DIR}/consumer.c" - ) - target_compile_options(consumer - PRIVATE - -DCONSUMER_LANG_$<COMPILE_LANGUAGE> - -DLANG_IS_CXX=$<COMPILE_LANGUAGE:CXX> - -DLANG_IS_C=$<COMPILE_LANGUAGE:C> - ) +target_sources(consumer PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/consumer.c" +) +target_compile_options(consumer + PRIVATE + -DCONSUMER_LANG_$<COMPILE_LANGUAGE> + -DLANG_IS_CXX=$<COMPILE_LANGUAGE:CXX> + -DLANG_IS_C=$<COMPILE_LANGUAGE:C> +) + +if(CMAKE_GENERATOR MATCHES "Visual Studio") target_compile_definitions(consumer - PRIVATE -DTEST_LANG_DEFINES + PRIVATE TEST_LANG_DEFINES_FOR_VISUAL_STUDIO ) endif() diff --git a/Tests/CMakeCommands/target_compile_options/consumer.c b/Tests/CMakeCommands/target_compile_options/consumer.c index 7931a6f..420b4cc 100644 --- a/Tests/CMakeCommands/target_compile_options/consumer.c +++ b/Tests/CMakeCommands/target_compile_options/consumer.c @@ -1,5 +1,23 @@ -#ifdef TEST_LANG_DEFINES +// Visual Studio allows only one set of flags for C and C++. +// In a target using C++ we pick the C++ flags even for C sources. +#ifdef TEST_LANG_DEFINES_FOR_VISUAL_STUDIO +#ifndef CONSUMER_LANG_CXX +#error Expected CONSUMER_LANG_CXX +#endif + +#ifdef CONSUMER_LANG_C +#error Unexpected CONSUMER_LANG_C +#endif + +#if !LANG_IS_CXX +#error Expected LANG_IS_CXX +#endif + +#if LANG_IS_C +#error Unexpected LANG_IS_C +#endif +#else #ifdef CONSUMER_LANG_CXX #error Unexpected CONSUMER_LANG_CXX #endif diff --git a/Tests/CMakeCommands/target_compile_options/consumer.cpp b/Tests/CMakeCommands/target_compile_options/consumer.cpp index 71a6098..7750950 100644 --- a/Tests/CMakeCommands/target_compile_options/consumer.cpp +++ b/Tests/CMakeCommands/target_compile_options/consumer.cpp @@ -15,7 +15,6 @@ #endif -#ifdef TEST_LANG_DEFINES #ifndef CONSUMER_LANG_CXX #error Expected CONSUMER_LANG_CXX #endif @@ -31,7 +30,6 @@ #if LANG_IS_C #error Unexpected LANG_IS_C #endif -#endif int main() { diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 1c69805..4a7b8c9 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -409,11 +409,14 @@ if(BUILD_TESTING) list(APPEND TEST_BUILD_DIRS ${CMake_TEST_INSTALL_PREFIX}) - if(NOT QT4_FOUND) + if(NOT DEFINED CMake_TEST_Qt4) + set(CMake_TEST_Qt4 1) + endif() + if(CMake_TEST_Qt4 AND NOT QT4_FOUND) find_package(Qt4 QUIET) endif() - if(QT4_FOUND) + if(CMake_TEST_Qt4 AND QT4_FOUND) # test whether the Qt4 which has been found works, on some machines # which run nightly builds there were errors like "wrong file format" # for libQtCore.so. So first check it works, and only if it does add @@ -1255,8 +1258,13 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set(QtAutogen_BUILD_OPTIONS -DCMAKE_BUILD_TYPE=$<CONFIGURATION>) endif() - find_package(Qt5Widgets QUIET NO_MODULE) - if(Qt5Widgets_FOUND) + if(NOT DEFINED CMake_TEST_Qt5) + set(CMake_TEST_Qt5 1) + endif() + if(CMake_TEST_Qt5) + find_package(Qt5Widgets QUIET NO_MODULE) + endif() + if(CMake_TEST_Qt5 AND Qt5Widgets_FOUND) add_test(NAME Qt5Autogen COMMAND ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/QtAutogen" @@ -3396,6 +3404,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release # sets "CMake_TEST_CONTRACT_<project>_<var>" variables to configure # the code below. foreach(project + PLplot Trilinos VTK ) 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/CTestTest2/test.cmake.in b/Tests/CTestTest2/test.cmake.in index 825b957..a9bbc52 100644 --- a/Tests/CTestTest2/test.cmake.in +++ b/Tests/CTestTest2/test.cmake.in @@ -34,6 +34,7 @@ CMAKE_C_COMPILER:STRING=@CMAKE_C_COMPILER@ CMAKE_CXX_COMPILER:STRING=@CMAKE_CXX_COMPILER@ CMAKE_C_COMPILER_ARG1:STRING=@CMAKE_C_COMPILER_ARG1@ CMAKE_CXX_COMPILER_ARG1:STRING=@CMAKE_CXX_COMPILER_ARG1@ +KWSYS_ENCODING_DEFAULT_CODEPAGE:STRING=CP_UTF8 # This one is needed for testing advanced ctest features CTEST_TEST_KWSYS:BOOL=ON diff --git a/Tests/Contracts/PLplot/CMakeLists.txt b/Tests/Contracts/PLplot/CMakeLists.txt new file mode 100644 index 0000000..b87b4c3 --- /dev/null +++ b/Tests/Contracts/PLplot/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.9) +project(PLplotDriver NONE) +include(ExternalProject) +include(${CMAKE_CURRENT_SOURCE_DIR}/../Home.cmake) +set(PLplot_PREFIX "${HOME}/.cmake/Contracts/PLplot") +file(REMOVE_RECURSE "${PLplot_PREFIX}") +separate_arguments(PLplot_CMAKE_ARGS UNIX_COMMAND "${PLplot_CMAKE_FLAGS}") +if(NOT PLplot_GIT_TAG) + set(PLplot_GIT_TAG "plplot-5.13.0") +endif() +ExternalProject_Add(PLplot + GIT_REPOSITORY "https://git.code.sf.net/p/plplot/plplot.git" + GIT_TAG "${PLplot_GIT_TAG}" + PREFIX "${PLplot_PREFIX}" + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> + ${PLplot_CMAKE_ARGS} + ) diff --git a/Tests/Contracts/PLplot/Configure.cmake b/Tests/Contracts/PLplot/Configure.cmake new file mode 100644 index 0000000..83591d4 --- /dev/null +++ b/Tests/Contracts/PLplot/Configure.cmake @@ -0,0 +1,4 @@ +set(Contracts.PLplot_BUILD_OPTIONS + -DPLplot_CMAKE_FLAGS=${CMake_TEST_CONTRACT_PLplot_CMAKE_FLAGS} + -DPLplot_GIT_TAG=${CMake_TEST_CONTRACT_PLplot_GIT_TAG} + ) diff --git a/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt b/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt index 7ef626f..cfca823 100644 --- a/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt +++ b/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt @@ -13,7 +13,13 @@ string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30") set(CMAKE_CXX_STANDARD 11) set(CMAKE_CUDA_STANDARD 11) +set(CMAKE_CUDA_SEPARABLE_COMPILATION ON) add_library(CUDASeparateLibA STATIC file1.cu file2.cu file3.cu) +get_property(sep_comp TARGET CUDASeparateLibA PROPERTY CUDA_SEPARABLE_COMPILATION) +if(NOT sep_comp) + message(FATAL_ERROR "CUDA_SEPARABLE_COMPILATION not initialized") +endif() +unset(CMAKE_CUDA_SEPARABLE_COMPILATION) if(CMAKE_CUDA_SIMULATE_ID STREQUAL "MSVC") # Test adding a flag that is not in our CUDA flag table for VS. diff --git a/Tests/CudaOnly/WithDefs/CMakeLists.txt b/Tests/CudaOnly/WithDefs/CMakeLists.txt index 9b82366..5bd93a4 100644 --- a/Tests/CudaOnly/WithDefs/CMakeLists.txt +++ b/Tests/CudaOnly/WithDefs/CMakeLists.txt @@ -32,6 +32,8 @@ add_executable(CudaOnlyWithDefs ${main}) target_compile_options(CudaOnlyWithDefs PRIVATE + -DCOMPILE_LANG_$<COMPILE_LANGUAGE> + -DLANG_IS_CUDA=$<COMPILE_LANGUAGE:CUDA> -Xcompiler=-DHOST_DEFINE $<$<CONFIG:DEBUG>:$<BUILD_INTERFACE:${debug_compile_flags}>> ) diff --git a/Tests/CudaOnly/WithDefs/main.notcu b/Tests/CudaOnly/WithDefs/main.notcu index d2eff3f..bfb3577 100644 --- a/Tests/CudaOnly/WithDefs/main.notcu +++ b/Tests/CudaOnly/WithDefs/main.notcu @@ -10,6 +10,18 @@ #error "PACKED_DEFINE not defined!" #endif +#ifndef COMPILE_LANG_CUDA +#error "COMPILE_LANG_CUDA not defined!" +#endif + +#ifndef LANG_IS_CUDA +#error "LANG_IS_CUDA not defined!" +#endif + +#if !LANG_IS_CUDA +#error "Expected LANG_IS_CUDA" +#endif + static __global__ void DetermineIfValidCudaDevice() { } diff --git a/Tests/FindOpenGL/Test/CMakeLists.txt b/Tests/FindOpenGL/Test/CMakeLists.txt index 3b5ffee..9004a98 100644 --- a/Tests/FindOpenGL/Test/CMakeLists.txt +++ b/Tests/FindOpenGL/Test/CMakeLists.txt @@ -1,4 +1,5 @@ -cmake_minimum_required(VERSION 3.9) +cmake_minimum_required(VERSION 3.10) +cmake_policy(SET CMP0072 NEW) project(TestFindOpenGL C) include(CTest) diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt index 1a6f204..ac3df65 100644 --- a/Tests/FindPackageTest/CMakeLists.txt +++ b/Tests/FindPackageTest/CMakeLists.txt @@ -565,6 +565,84 @@ endif() ####################### +write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/Zot123ConfigVersion.cmake + VERSION 1.2.3.17 + COMPATIBILITY SameMinorVersion) + +unset(PACKAGE_VERSION_UNSUITABLE) +set(PACKAGE_VERSION_EXACT FALSE) +set(PACKAGE_FIND_VERSION 2.3.4) +set(PACKAGE_FIND_VERSION_MAJOR 2) +set(PACKAGE_FIND_VERSION_MINOR 3) +include(${CMAKE_CURRENT_BINARY_DIR}/Zot123ConfigVersion.cmake) +if(PACKAGE_VERSION_COMPATIBLE) + message(SEND_ERROR "Found Zot123 with version 1.2.3.17, but 2.3.4 was requested !") +endif() +if(PACKAGE_VERSION_EXACT) + message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !") +endif() + +set(PACKAGE_FIND_VERSION 0.0.1) +set(PACKAGE_FIND_VERSION_MAJOR 0) +set(PACKAGE_FIND_VERSION_MINOR 0) +include(${CMAKE_CURRENT_BINARY_DIR}/Zot123ConfigVersion.cmake) +if(PACKAGE_VERSION_COMPATIBLE) + message(SEND_ERROR "Found Zot123 with version 1.2.3.17, but 0.0.1 was requested !") +endif() +if(PACKAGE_VERSION_EXACT) + message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !") +endif() + +set(PACKAGE_FIND_VERSION 1.0.0) +set(PACKAGE_FIND_VERSION_MAJOR 1) +set(PACKAGE_FIND_VERSION_MINOR 0) +include(${CMAKE_CURRENT_BINARY_DIR}/Zot123ConfigVersion.cmake) +if(PACKAGE_VERSION_COMPATIBLE) + message(SEND_ERROR "Found Zot123 with version 1.2.3.17 (1.0.0 was requested) !") +endif() +if(PACKAGE_VERSION_EXACT) + message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !") +endif() + +set(PACKAGE_FIND_VERSION 1.2.0) +set(PACKAGE_FIND_VERSION_MAJOR 1) +set(PACKAGE_FIND_VERSION_MINOR 2) +include(${CMAKE_CURRENT_BINARY_DIR}/Zot123ConfigVersion.cmake) +if(NOT PACKAGE_VERSION_COMPATIBLE) + message(SEND_ERROR "Did not find Zot123 with version 1.2.3.17 (1.2.0 was requested) !") +endif() +if(PACKAGE_VERSION_EXACT) + message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !") +endif() + +set(PACKAGE_FIND_VERSION 1.2.3) +set(PACKAGE_FIND_VERSION_MAJOR 1) +set(PACKAGE_FIND_VERSION_MINOR 2) +include(${CMAKE_CURRENT_BINARY_DIR}/Zot123ConfigVersion.cmake) +if(NOT PACKAGE_VERSION_COMPATIBLE) + message(SEND_ERROR "Did not find Zot123 with version 1.2.3.17 (1.2.3 was requested) !") +endif() +if(PACKAGE_VERSION_EXACT) + message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !") +endif() + +set(PACKAGE_FIND_VERSION 1.2.3.17) +set(PACKAGE_FIND_VERSION_MAJOR 1) +set(PACKAGE_FIND_VERSION_MINOR 2) +include(${CMAKE_CURRENT_BINARY_DIR}/Zot123ConfigVersion.cmake) +if(NOT PACKAGE_VERSION_COMPATIBLE) + message(SEND_ERROR "Did not find Zot123 with version 1.2.3.17 (1.2.3.17 was requested) !") +endif() +if(NOT PACKAGE_VERSION_EXACT) + message(SEND_ERROR "PACKAGE_VERSION_EXACT not set, although it should be !") +endif() + +if(PACKAGE_VERSION_UNSUITABLE) + message(SEND_ERROR "PACKAGE_VERSION_UNSUITABLE set, but must not be !") +endif() + +####################### + write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake VERSION 1.2.3.17 COMPATIBILITY ExactVersion) @@ -574,7 +652,7 @@ set(PACKAGE_VERSION_EXACT FALSE) set(PACKAGE_FIND_VERSION 2.3.4) include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake) if(PACKAGE_VERSION_COMPATIBLE) - message(SEND_ERROR "Found Bar123 with version 1.2.3 (2.3.4 was requested) !") + message(SEND_ERROR "Found Bar123 with version 1.2.3.17 (2.3.4 was requested) !") endif() if(PACKAGE_VERSION_EXACT) message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !") @@ -583,7 +661,7 @@ endif() set(PACKAGE_FIND_VERSION 1.2) include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake) if(PACKAGE_VERSION_COMPATIBLE) - message(SEND_ERROR "Found Bar123 with version 1.2.3 (1.2 was requested) !") + message(SEND_ERROR "Found Bar123 with version 1.2.3.17 (1.2 was requested) !") endif() if(PACKAGE_VERSION_EXACT) message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !") @@ -592,7 +670,7 @@ endif() set(PACKAGE_FIND_VERSION 1) include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake) if(PACKAGE_VERSION_COMPATIBLE) - message(SEND_ERROR "Found Bar123 with version 1.2.3 (1 was requested) !") + message(SEND_ERROR "Found Bar123 with version 1.2.3.17 (1 was requested) !") endif() if(PACKAGE_VERSION_EXACT) message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !") @@ -601,7 +679,7 @@ endif() set(PACKAGE_FIND_VERSION 1.2.3.4) include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake) if(NOT PACKAGE_VERSION_COMPATIBLE) - message(SEND_ERROR "Did not find Bar123 with version 1.2.3 (1.2.3.4 was requested) !") + message(SEND_ERROR "Did not find Bar123 with version 1.2.3.17 (1.2.3.4 was requested) !") endif() if(PACKAGE_VERSION_EXACT) message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !") @@ -612,19 +690,18 @@ set(PACKAGE_VERSION_EXACT FALSE) set(PACKAGE_VERSION_COMPATIBLE FALSE) include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake) if(NOT PACKAGE_VERSION_COMPATIBLE) - message(SEND_ERROR "Did not find Bar123 with version 1.2.3 (1.2.3 was requested) !") + message(SEND_ERROR "Did not find Bar123 with version 1.2.3.17 (1.2.3 was requested) !") endif() if(PACKAGE_VERSION_EXACT) message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !") endif() - set(PACKAGE_FIND_VERSION 1.2.3.17) set(PACKAGE_VERSION_EXACT FALSE) set(PACKAGE_VERSION_COMPATIBLE FALSE) include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake) if(NOT PACKAGE_VERSION_COMPATIBLE) - message(SEND_ERROR "Did not find Bar123 with version 1.2.3 (1.2.3.17 was requested) !") + message(SEND_ERROR "Did not find Bar123 with version 1.2.3.17 (1.2.3.17 was requested) !") endif() if(NOT PACKAGE_VERSION_EXACT) message(SEND_ERROR "PACKAGE_VERSION_EXACT not set, although it should be !") diff --git a/Tests/FindPatch/Test/CMakeLists.txt b/Tests/FindPatch/Test/CMakeLists.txt index f4cd621..66c672c 100644 --- a/Tests/FindPatch/Test/CMakeLists.txt +++ b/Tests/FindPatch/Test/CMakeLists.txt @@ -70,8 +70,8 @@ index 68059b3..c6f30c2 100644 ) add_custom_target(TestPatch ALL - COMMAND ${Patch_EXECUTABLE} -p1 -i quote-add-author.patch - COMMAND Patch::patch -p1 -i quote-add-date.patch + COMMAND ${Patch_EXECUTABLE} -p1 -i quote-add-author.patch --binary + COMMAND Patch::patch -p1 -i quote-add-date.patch --binary COMMAND ${CMAKE_COMMAND} -E compare_files QUOTE.txt QUOTE.txt.baseline WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 5d584af..aa075b0 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -144,6 +144,7 @@ add_RunCMake_test(ExternalData) add_RunCMake_test(FeatureSummary) add_RunCMake_test(FPHSA) add_RunCMake_test(FindBoost) +add_RunCMake_test(FindOpenGL) if(NOT CMAKE_C_COMPILER_ID MATCHES "Watcom") add_RunCMake_test(GenerateExportHeader) endif() @@ -218,6 +219,7 @@ add_RunCMake_test(find_library) add_RunCMake_test(find_package) add_RunCMake_test(find_path) add_RunCMake_test(find_program -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}) +add_RunCMake_test(foreach) add_RunCMake_test(get_filename_component) add_RunCMake_test(get_property) add_RunCMake_test(if) @@ -383,6 +385,9 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") if(DEFINED CMake_TEST_CUDA) list(APPEND CompilerLauncher_ARGS -DCMake_TEST_CUDA=${CMake_TEST_CUDA}) endif() + if(CMAKE_Fortran_COMPILER) + list(APPEND CompilerLauncher_ARGS -DCMake_TEST_Fortran=1) + endif() add_RunCMake_test(CompilerLauncher) add_RunCMake_test(ctest_labels_for_subprojects) endif() diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt index 73b66ac..42c1485 100644 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt @@ -3,6 +3,7 @@ CMake Error at CompileDefinitions.cmake:5 \(target_compile_definitions\): \$<COMPILE_LANGUAGE:CXX> - \$<COMPILE_LANGUAGE:...> may not be used with Visual Studio generators. + \$<COMPILE_LANGUAGE:...> may only be used for COMPILE_OPTIONS and + file\(GENERATE\) with the Visual Studio generator. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt index a1ed633..7879a79 100644 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt @@ -3,7 +3,7 @@ CMake Error at CompileDefinitions.cmake:5 \(target_compile_definitions\): \$<COMPILE_LANGUAGE:CXX> - \$<COMPILE_LANGUAGE:...> may only be used with COMPILE_OPTIONS with the - Xcode generator. + \$<COMPILE_LANGUAGE:...> may only be used for COMPILE_OPTIONS and + file\(GENERATE\) with the Xcode generator. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt deleted file mode 100644 index e9e8e9f..0000000 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt +++ /dev/null @@ -1,8 +0,0 @@ -CMake Error at CompileOptions.cmake:5 \(target_compile_options\): - Error evaluating generator expression: - - \$<COMPILE_LANGUAGE:CXX> - - \$<COMPILE_LANGUAGE:...> may not be used with Visual Studio generators. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake deleted file mode 100644 index 6c92abc..0000000 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake +++ /dev/null @@ -1,5 +0,0 @@ - -enable_language(CXX) - -add_executable(main main.cpp) -target_compile_options(main PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-DANYTHING>) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt index ec15068..3806ed1 100644 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt @@ -3,6 +3,7 @@ CMake Error at IncludeDirectories.cmake:5 \(target_include_directories\): \$<COMPILE_LANGUAGE:CXX> - \$<COMPILE_LANGUAGE:...> may not be used with Visual Studio generators. + \$<COMPILE_LANGUAGE:...> may only be used for COMPILE_OPTIONS and + file\(GENERATE\) with the Visual Studio generator. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt index fdf92b2..a3fb9c5 100644 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt @@ -3,7 +3,7 @@ CMake Error at IncludeDirectories.cmake:5 \(target_include_directories\): \$<COMPILE_LANGUAGE:CXX> - \$<COMPILE_LANGUAGE:...> may only be used with COMPILE_OPTIONS with the - Xcode generator. + \$<COMPILE_LANGUAGE:...> may only be used for COMPILE_OPTIONS and + file\(GENERATE\) with the Xcode generator. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake index 5e0a5f5..421fa73 100644 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake @@ -1,9 +1,5 @@ include(RunCMake) -if (RunCMake_GENERATOR MATCHES "Visual Studio") - set(RunCMake-stderr-file CompileOptions-stderr-VS.txt) - run_cmake(CompileOptions) -endif() if (RunCMake_GENERATOR STREQUAL "Xcode") set(RunCMake-stderr-file CompileDefinitions-stderr-Xcode.txt) run_cmake(CompileDefinitions) diff --git a/Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake b/Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake index 99d3155..948c6ab 100644 --- a/Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake +++ b/Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake @@ -45,13 +45,22 @@ function(toExpectedContentList FILE_NO CONTENT_VAR) unset(prefix_) endif() - if(NOT DEFINED TEST_MAIN_INSTALL_PREFIX_PATH) - set(TEST_MAIN_INSTALL_PREFIX_PATH "/usr") + # add install prefix to expected paths + if(DEFINED EXPECTED_FILE_${FILE_NO}_PACKAGING_PREFIX) + set(EXPECTED_FILE_PACKAGING_PREFIX + "${EXPECTED_FILE_${FILE_NO}_PACKAGING_PREFIX}") + elseif(NOT DEFINED EXPECTED_FILE_PACKAGING_PREFIX) + # default CPack Archive packaging install prefix + set(EXPECTED_FILE_PACKAGING_PREFIX "/") endif() + set(prepared_ "${EXPECTED_FILE_PACKAGING_PREFIX}") + foreach(part_ IN LISTS ${CONTENT_VAR}) + list(APPEND prepared_ "${EXPECTED_FILE_PACKAGING_PREFIX}${part_}") + endforeach() unset(filtered_) - foreach(part_ IN LISTS ${CONTENT_VAR}) - string(REGEX REPLACE "^${TEST_MAIN_INSTALL_PREFIX_PATH}(/|$)" "" part_ "${part_}") + foreach(part_ IN LISTS prepared_) + string(REGEX REPLACE "^/" "" part_ "${part_}") if(part_) list(APPEND filtered_ "${prefix_}${part_}") diff --git a/Tests/RunCMake/CPack/CPackTestHelpers.cmake b/Tests/RunCMake/CPack/CPackTestHelpers.cmake index f883c69..447b08b 100644 --- a/Tests/RunCMake/CPack/CPackTestHelpers.cmake +++ b/Tests/RunCMake/CPack/CPackTestHelpers.cmake @@ -35,10 +35,27 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACK "-DRunCMake_TEST_FILE_PREFIX=${TEST_NAME}" "-DRunCMake_SUBTEST_SUFFIX=${SUBTEST_SUFFIX}" "-DPACKAGING_TYPE=${PACKAGING_TYPE}") + + foreach(o out err) + if(SUBTEST_SUFFIX AND EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/configure-${PACKAGING_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt) + set(RunCMake-std${o}-file "tests/${TEST_NAME}/configure-${PACKAGING_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt") + elseif(SUBTEST_SUFFIX AND EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/configure-${SUBTEST_SUFFIX}-std${o}.txt) + set(RunCMake-std${o}-file "tests/${TEST_NAME}/configure-${SUBTEST_SUFFIX}-std${o}.txt") + elseif(EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/configure-${PACKAGING_TYPE}-std${o}.txt) + set(RunCMake-std${o}-file "tests/${TEST_NAME}/configure-${PACKAGING_TYPE}-std${o}.txt") + elseif(EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/configure-std${o}.txt) + set(RunCMake-std${o}-file "tests/${TEST_NAME}/configure-std${o}.txt") + else() + unset(RunCMake-std${o}-file) + endif() + endforeach() + run_cmake(${full_test_name_}) # execute optional build step if(build) + unset(RunCMake-stdout-file) + unset(RunCMake-stderr-file) run_cmake_command(${full_test_name_}-Build "${CMAKE_COMMAND}" --build "${RunCMake_TEST_BINARY_DIR}") endif() @@ -68,8 +85,12 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACK set(RunCMake-std${o}-file "tests/${TEST_NAME}/${TEST_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt") elseif(EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${TEST_TYPE}-std${o}.txt) set(RunCMake-std${o}-file "tests/${TEST_NAME}/${TEST_TYPE}-std${o}.txt") + elseif(SUBTEST_SUFFIX AND EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${SUBTEST_SUFFIX}-std${o}.txt) + set(RunCMake-std${o}-file "tests/${TEST_NAME}/${SUBTEST_SUFFIX}-std${o}.txt") elseif(EXISTS ${RunCMake_SOURCE_DIR}/${TEST_TYPE}/default_expected_std${o}.txt) set(RunCMake-std${o}-file "${TEST_TYPE}/default_expected_std${o}.txt") + else() + unset(RunCMake-std${o}-file) endif() endforeach() diff --git a/Tests/RunCMake/CPack/DEB/Helpers.cmake b/Tests/RunCMake/CPack/DEB/Helpers.cmake index 6d8e84a..f7c5c84 100644 --- a/Tests/RunCMake/CPack/DEB/Helpers.cmake +++ b/Tests/RunCMake/CPack/DEB/Helpers.cmake @@ -47,7 +47,20 @@ function(getPackageContentList FILE RESULT_VAR) endfunction() function(toExpectedContentList FILE_NO CONTENT_VAR) - # no need to do anything + # add install prefix to expected paths + if(DEFINED EXPECTED_FILE_${FILE_NO}_PACKAGING_PREFIX) + set(EXPECTED_FILE_PACKAGING_PREFIX + "${EXPECTED_FILE_${FILE_NO}_PACKAGING_PREFIX}") + elseif(NOT DEFINED EXPECTED_FILE_PACKAGING_PREFIX) + # default CPackDeb packaging install prefix + set(EXPECTED_FILE_PACKAGING_PREFIX "/usr") + endif() + set(prepared_ "${EXPECTED_FILE_PACKAGING_PREFIX}") + foreach(part_ IN LISTS ${CONTENT_VAR}) + list(APPEND prepared_ "${EXPECTED_FILE_PACKAGING_PREFIX}${part_}") + endforeach() + + set(${CONTENT_VAR} "${prepared_}" PARENT_SCOPE) endfunction() function(getMissingShlibsErrorExtra FILE RESULT_VAR) diff --git a/Tests/RunCMake/CPack/README.txt b/Tests/RunCMake/CPack/README.txt index 5a95927..2e2abdf 100644 --- a/Tests/RunCMake/CPack/README.txt +++ b/Tests/RunCMake/CPack/README.txt @@ -96,6 +96,14 @@ the test has to run some functions after CPack.cmake is included. In such cases a function run_after_include_cpack can be declared in test.cmake file and that function will run after the inclusion of CPack.cmake. +NOTE: During CMake configure stage developer warnings may be expected. In such +cases an expected output regular expression can be provided by creating +'<test_name>/configure-stdout.txt' and/or '<test_name>/configure-stderr.txt' +file. There are also more specialized versions of the file available: +- configure-${PACKAGING_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt +- configure-${SUBTEST_SUFFIX}-std${o}.txt +- configure-${PACKAGING_TYPE}-std${o}.txt + build phase (optional and not available for source package tests) ----------------------------------------------------------------- @@ -153,13 +161,19 @@ this step and must contain is later changed automatically depending on the generator so expected package content can be written only once per test for all generators. +- EXPECTED_FILE_PACKAGING_PREFIX and + EXPECTED_FILE_<file_number_starting_with_1>_PACKAGING_PREFIX variables can be + set to explicitly specified CPACK_PACKAGING_PREFIX value. By default this + variable does not need to be set as it is implicitly set to package generator + specific prefix. + Optional verification phase is generator specific and is optionaly executed. This phase is executed if '<test_name>/VerifyResult.cmake' script exists. VerifyResult.cmake script also automatically prints out standard output and standard error from CPack execution phase that is compared with '<test_name>/<generator_name>-stdout.txt' regular expression and -and '<test_name>/<generator_name>-stderr.txt' regular expresson respectively. +'<test_name>/<generator_name>-stderr.txt' regular expresson respectively. NOTE: For subtests generator name can also be suffixed with subtest name and/or packaging type (MONOLITHIC, COMPONENT, GROUP) and in such cases the preferences of which file will be used are as follows: @@ -167,6 +181,7 @@ NOTE: For subtests generator name can also be suffixed with subtest name and/or - generator name + packaging type - generator name + subtest name - generator name + - subtest name - default generator File name format: '<generator_name>-<packaging_type>-<subtest_name>-std<type>.txt' where <type> can either be 'out' or 'err'. diff --git a/Tests/RunCMake/CPack/RPM/Helpers.cmake b/Tests/RunCMake/CPack/RPM/Helpers.cmake index 88fc231..a29c020 100644 --- a/Tests/RunCMake/CPack/RPM/Helpers.cmake +++ b/Tests/RunCMake/CPack/RPM/Helpers.cmake @@ -47,14 +47,29 @@ function(getPackageContentList FILE RESULT_VAR) endfunction() function(toExpectedContentList FILE_NO CONTENT_VAR) - if(NOT DEFINED TEST_INSTALL_PREFIX_PATHS) - set(TEST_INSTALL_PREFIX_PATHS "/usr") + # add install prefix to expected paths + if(DEFINED EXPECTED_FILE_${FILE_NO}_PACKAGING_PREFIX) + set(EXPECTED_FILE_PACKAGING_PREFIX + "${EXPECTED_FILE_${FILE_NO}_PACKAGING_PREFIX}") + elseif(NOT DEFINED EXPECTED_FILE_PACKAGING_PREFIX) + # default CPackRPM packaging install prefix + set(EXPECTED_FILE_PACKAGING_PREFIX "/usr") endif() + set(prepared_ "${EXPECTED_FILE_PACKAGING_PREFIX}") + foreach(part_ IN LISTS ${CONTENT_VAR}) + list(APPEND prepared_ "${EXPECTED_FILE_PACKAGING_PREFIX}${part_}") + endforeach() + # remove paths that are excluded from auto packaging + if(NOT DEFINED CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST) + set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST + /etc /etc/init.d /usr /usr/bin /usr/include /usr/lib + /usr/libx32 /usr/lib64 /usr/share /usr/share/aclocal /usr/share/doc) + endif() unset(filtered_) - foreach(part_ IN LISTS ${CONTENT_VAR}) + foreach(part_ IN LISTS prepared_) unset(dont_add_) - foreach(for_removal_ IN LISTS TEST_INSTALL_PREFIX_PATHS) + foreach(for_removal_ IN LISTS CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST) if(part_ STREQUAL for_removal_) set(dont_add_ TRUE) break() diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index b00e373..4b7f146 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -7,6 +7,7 @@ include("${RunCMake_SOURCE_DIR}/CPackTestHelpers.cmake") run_cpack_test(CUSTOM_BINARY_SPEC_FILE "RPM" false "MONOLITHIC;COMPONENT") run_cpack_test(CUSTOM_NAMES "RPM;DEB;TGZ" true "COMPONENT") run_cpack_test(DEBUGINFO "RPM" true "COMPONENT") +run_cpack_test_subtests(DEFAULT_PERMISSIONS "CMAKE_var_set;CPACK_var_set;both_set;invalid_CMAKE_var;invalid_CPACK_var" "RPM;DEB" false "MONOLITHIC;COMPONENT") run_cpack_test(DEPENDENCIES "RPM;DEB" true "COMPONENT") run_cpack_test(DIST "RPM" false "MONOLITHIC") run_cpack_test(EMPTY_DIR "RPM;DEB;TGZ" true "MONOLITHIC;COMPONENT") diff --git a/Tests/RunCMake/CPack/STGZ/Helpers.cmake b/Tests/RunCMake/CPack/STGZ/Helpers.cmake index 68b1eab..1756645 100644 --- a/Tests/RunCMake/CPack/STGZ/Helpers.cmake +++ b/Tests/RunCMake/CPack/STGZ/Helpers.cmake @@ -47,18 +47,29 @@ function(toExpectedContentList FILE_NO CONTENT_VAR) string(SUBSTRING "${prefix_}" 0 ${pos_} prefix_) endif() - if(NOT DEFINED TEST_MAIN_INSTALL_PREFIX_PATH) - set(TEST_MAIN_INSTALL_PREFIX_PATH "/usr") + # add install prefix to expected paths + if(DEFINED EXPECTED_FILE_${FILE_NO}_PACKAGING_PREFIX) + set(EXPECTED_FILE_PACKAGING_PREFIX + "${EXPECTED_FILE_${FILE_NO}_PACKAGING_PREFIX}") + elseif(NOT DEFINED EXPECTED_FILE_PACKAGING_PREFIX) + # default CPack Archive packaging install prefix + set(EXPECTED_FILE_PACKAGING_PREFIX "/") endif() - set(filtered_ "${prefix_}") - foreach(part_ IN LISTS ${CONTENT_VAR}) - string(REGEX REPLACE "^${TEST_MAIN_INSTALL_PREFIX_PATH}(/|$)" "" part_ "${part_}") + # remove trailing slash otherwise path concatenation will cause double slashes + string(REGEX REPLACE "/$" "" EXPECTED_FILE_PACKAGING_PREFIX + "${EXPECTED_FILE_PACKAGING_PREFIX}") + + if(EXPECTED_FILE_PACKAGING_PREFIX) + set(prepared_ "${prefix_}") + else() + unset(prepared_) + endif() - if(part_) - list(APPEND filtered_ "${prefix_}/${part_}") - endif() + list(APPEND prepared_ "${prefix_}${EXPECTED_FILE_PACKAGING_PREFIX}") + foreach(part_ IN LISTS ${CONTENT_VAR}) + list(APPEND prepared_ "${prefix_}${EXPECTED_FILE_PACKAGING_PREFIX}${part_}") endforeach() - set(${CONTENT_VAR} "${filtered_}" PARENT_SCOPE) + set(${CONTENT_VAR} "${prepared_}" PARENT_SCOPE) endfunction() diff --git a/Tests/RunCMake/CPack/tests/CPACK_INSTALL_SCRIPT/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/CPACK_INSTALL_SCRIPT/ExpectedFiles.cmake index 5cb12c3..02a7821 100644 --- a/Tests/RunCMake/CPack/tests/CPACK_INSTALL_SCRIPT/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/CPACK_INSTALL_SCRIPT/ExpectedFiles.cmake @@ -1,3 +1,3 @@ set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/abc.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/abc.txt") diff --git a/Tests/RunCMake/CPack/tests/CUSTOM_BINARY_SPEC_FILE/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/CUSTOM_BINARY_SPEC_FILE/ExpectedFiles.cmake index 694dc00..6d895ec 100644 --- a/Tests/RunCMake/CPack/tests/CUSTOM_BINARY_SPEC_FILE/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/CUSTOM_BINARY_SPEC_FILE/ExpectedFiles.cmake @@ -1,9 +1,9 @@ set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") if(PACKAGING_TYPE STREQUAL "COMPONENT") set(EXPECTED_FILES_COUNT "2") set(EXPECTED_FILE_1_COMPONENT "test") set(EXPECTED_FILE_2_COMPONENT "test2") - set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/bar;/usr/bar/CMakeLists.txt") + set(EXPECTED_FILE_CONTENT_2_LIST "/bar;/bar/CMakeLists.txt") endif() diff --git a/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake index 5cb280c..07226df 100644 --- a/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake @@ -1,10 +1,10 @@ set(EXPECTED_FILES_COUNT "3") set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) set(EXPECTED_FILE_1_COMPONENT "pkg_1") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") set(EXPECTED_FILE_2_NAME "second") -set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") -set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_2_LIST "/foo;/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_3_LIST "/foo;/foo/CMakeLists.txt") if(GENERATOR_TYPE STREQUAL "DEB" OR GENERATOR_TYPE STREQUAL "RPM") string(TOLOWER "${GENERATOR_TYPE}" file_extension_) diff --git a/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake index 3d8de74..b26c6c7 100644 --- a/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake @@ -5,11 +5,11 @@ set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) set(EXPECTED_FILE_1_NAME "Debuginfo") set(EXPECTED_FILE_1_COMPONENT "applications") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/test_prog") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/test_prog") set(EXPECTED_FILE_2 "TestDinfo-pkg*-headers.rpm") -set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/bar;/usr/bar/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_2_LIST "/bar;/bar/CMakeLists.txt") set(EXPECTED_FILE_3 "TestDinfo-pkg*-libs.rpm") -set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/bas;/usr/bas/libtest_lib.so") +set(EXPECTED_FILE_CONTENT_3_LIST "/bas;/bas/libtest_lib.so") set(EXPECTED_FILE_4_NAME "Debuginfo") set(EXPECTED_FILE_4_COMPONENT "applications-debuginfo") diff --git a/Tests/RunCMake/CPack/tests/DEB_PACKAGE_VERSION_BACK_COMPATIBILITY/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DEB_PACKAGE_VERSION_BACK_COMPATIBILITY/ExpectedFiles.cmake index 6142eb3..d1a3a5f 100644 --- a/Tests/RunCMake/CPack/tests/DEB_PACKAGE_VERSION_BACK_COMPATIBILITY/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/DEB_PACKAGE_VERSION_BACK_COMPATIBILITY/ExpectedFiles.cmake @@ -1,2 +1,2 @@ set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/ExpectedFiles.cmake new file mode 100644 index 0000000..b6fcc17 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/ExpectedFiles.cmake @@ -0,0 +1,6 @@ +if(${RunCMake_SUBTEST_SUFFIX} MATCHES "invalid_.*_var") + set(EXPECTED_FILES_COUNT "0") +else() + set(EXPECTED_FILES_COUNT "1") + set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") +endif() diff --git a/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/VerifyResult.cmake new file mode 100644 index 0000000..16ebcdc --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/VerifyResult.cmake @@ -0,0 +1,39 @@ +if(NOT ${RunCMake_SUBTEST_SUFFIX} MATCHES "invalid_.*_var") + if(GENERATOR_TYPE STREQUAL "RPM") + function(checkContentPermissions_ FILE REGEX) + execute_process(COMMAND ${RPM_EXECUTABLE} -qp --dump ${FILE} + WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" + OUTPUT_VARIABLE PERMISSIONS_ + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if(NOT PERMISSIONS_ MATCHES "${REGEX}") + message(FATAL_ERROR "Permissions in '${FILE}'. Permissions: '${PERMISSIONS_}'") + endif() + endfunction() + + if(${RunCMake_SUBTEST_SUFFIX} MATCHES "CMAKE_var_set") + checkContentPermissions_("${FOUND_FILE_1}" + "/usr/foo .*740 root root.*") + else() + checkContentPermissions_("${FOUND_FILE_1}" + "/usr/foo .*700 root root.*") + endif() + else() # DEB + function(checkContentPermissions_ FILE REGEX) + getPackageContent("${FILE}" PERMISSIONS_) + + if(NOT PERMISSIONS_ MATCHES "${REGEX}") + message(FATAL_ERROR "Permissions in '${FILE}'. Permissions: '${PERMISSIONS_}'") + endif() + endfunction() + + if(${RunCMake_SUBTEST_SUFFIX} MATCHES "CMAKE_var_set") + checkContentPermissions_("${FOUND_FILE_1}" + "drwxr----- root/root .* ./usr/\ndrwxr----- root/root .* ./usr/foo/\n.*") + else() + checkContentPermissions_("${FOUND_FILE_1}" + "drwx------ root/root .* ./usr/\ndrwx------ root/root .* ./usr/foo/\n.*") + endif() + endif() +endif() diff --git a/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/invalid_CMAKE_var-stderr.txt b/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/invalid_CMAKE_var-stderr.txt new file mode 100644 index 0000000..541763a --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/invalid_CMAKE_var-stderr.txt @@ -0,0 +1 @@ +.*CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS value is invalid.* diff --git a/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/invalid_CPACK_var-stderr.txt b/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/invalid_CPACK_var-stderr.txt new file mode 100644 index 0000000..541763a --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/invalid_CPACK_var-stderr.txt @@ -0,0 +1 @@ +.*CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS value is invalid.* diff --git a/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/test.cmake b/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/test.cmake new file mode 100644 index 0000000..afe9390 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/test.cmake @@ -0,0 +1,34 @@ +if(${RunCMake_SUBTEST_SUFFIX} MATCHES "CMAKE_var_set" OR + ${RunCMake_SUBTEST_SUFFIX} MATCHES "both_set") + + set(CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS + OWNER_READ + OWNER_WRITE + OWNER_EXECUTE + GROUP_READ + ) +endif() + +if(${RunCMake_SUBTEST_SUFFIX} MATCHES "invalid_CMAKE_var") + list(APPEND CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS "INVALID") +endif() + +if(${RunCMake_SUBTEST_SUFFIX} MATCHES "CPACK_var_set" OR + ${RunCMake_SUBTEST_SUFFIX} MATCHES "both_set") + + set(CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS + OWNER_READ + OWNER_WRITE + OWNER_EXECUTE + ) +endif() + +if(${RunCMake_SUBTEST_SUFFIX} MATCHES "invalid_CPACK_var") + list(APPEND CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS "INVALID") +endif() + +install(FILES CMakeLists.txt DESTINATION foo COMPONENT test) + +if(PACKAGING_TYPE STREQUAL "COMPONENT") + set(CPACK_COMPONENTS_ALL test) +endif() diff --git a/Tests/RunCMake/CPack/tests/DEPENDENCIES/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DEPENDENCIES/ExpectedFiles.cmake index 3b280ba..be7ba07 100644 --- a/Tests/RunCMake/CPack/tests/DEPENDENCIES/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/DEPENDENCIES/ExpectedFiles.cmake @@ -1,14 +1,14 @@ set(EXPECTED_FILES_COUNT "5") set(EXPECTED_FILE_1_COMPONENT "applications") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/test_prog") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/test_prog") set(EXPECTED_FILE_2_COMPONENT "applications_auto") -set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/foo_auto;/usr/foo_auto/test_prog") +set(EXPECTED_FILE_CONTENT_2_LIST "/foo_auto;/foo_auto/test_prog") set(EXPECTED_FILE_3_COMPONENT "headers") -set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/bar;/usr/bar/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_3_LIST "/bar;/bar/CMakeLists.txt") set(EXPECTED_FILE_4_COMPONENT "libs") -set(EXPECTED_FILE_CONTENT_4_LIST "/usr/bas;/usr/bas/libtest_lib.so") +set(EXPECTED_FILE_CONTENT_4_LIST "/bas;/bas/libtest_lib.so") set(EXPECTED_FILE_5_COMPONENT "libs_auto") -set(EXPECTED_FILE_CONTENT_5_LIST "/usr;/usr/bas_auto;/usr/bas_auto/libtest_lib.so") +set(EXPECTED_FILE_CONTENT_5_LIST "/bas_auto;/bas_auto/libtest_lib.so") if(GENERATOR_TYPE STREQUAL "DEB") set(whitespaces_ "[\t\n\r ]*") diff --git a/Tests/RunCMake/CPack/tests/DIST/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DIST/ExpectedFiles.cmake index 6142eb3..d1a3a5f 100644 --- a/Tests/RunCMake/CPack/tests/DIST/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/DIST/ExpectedFiles.cmake @@ -1,2 +1,2 @@ set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/EMPTY_DIR/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/EMPTY_DIR/ExpectedFiles.cmake index 650687c..8df6831 100644 --- a/Tests/RunCMake/CPack/tests/EMPTY_DIR/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/EMPTY_DIR/ExpectedFiles.cmake @@ -1,6 +1,6 @@ set(EXPECTED_FILES_COUNT "1") set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/empty") +set(EXPECTED_FILE_CONTENT_1_LIST "/empty") if(PACKAGING_TYPE STREQUAL "COMPONENT") set(EXPECTED_FILE_1_COMPONENT "test") diff --git a/Tests/RunCMake/CPack/tests/EXTRA/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/EXTRA/ExpectedFiles.cmake index ded2923..407cbe6 100644 --- a/Tests/RunCMake/CPack/tests/EXTRA/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/EXTRA/ExpectedFiles.cmake @@ -1,8 +1,8 @@ set(EXPECTED_FILES_COUNT "3") set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) set(EXPECTED_FILE_1_COMPONENT "foo") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") set(EXPECTED_FILE_2_COMPONENT "bar") -set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/bar;/usr/bar/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_2_LIST "/bar;/bar/CMakeLists.txt") set(EXPECTED_FILE_3_COMPONENT "bas") -set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/bas;/usr/bas/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_3_LIST "/bas;/bas/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/EXTRA_SLASH_IN_PATH/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/EXTRA_SLASH_IN_PATH/ExpectedFiles.cmake index a45b38d..974df22 100644 --- a/Tests/RunCMake/CPack/tests/EXTRA_SLASH_IN_PATH/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/EXTRA_SLASH_IN_PATH/ExpectedFiles.cmake @@ -2,6 +2,7 @@ set(whitespaces_ "[\t\n\r ]*") set(EXPECTED_FILES_COUNT "5") set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) +set(EXPECTED_FILE_PACKAGING_PREFIX "") set(EXPECTED_FILE_1_COMPONENT "applications") set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/test_prog") diff --git a/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/ExpectedFiles.cmake index 44346ab..de38df9 100644 --- a/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/ExpectedFiles.cmake @@ -1,5 +1,5 @@ set(EXPECTED_FILES_COUNT "2") set(EXPECTED_FILE_1_COMPONENT "foo") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") set(EXPECTED_FILE_2_COMPONENT "bar") -set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/bar;/usr/bar/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_2_LIST "/bar;/bar/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/LONG_FILENAMES/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/LONG_FILENAMES/ExpectedFiles.cmake index 631d957..4cb8dd0 100644 --- a/Tests/RunCMake/CPack/tests/LONG_FILENAMES/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/LONG_FILENAMES/ExpectedFiles.cmake @@ -1,3 +1,3 @@ set(EXPECTED_FILES_COUNT "1") set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/llllllllll_oooooooooo_nnnnnnnnnn_gggggggggg_ffffffffff_iiiiiiiiii_llllllllll_eeeeeeeeee_nnnnnnnnnn_aaaaaaaaaa_mmmmmmmmmm_eeeeeeeeee.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/llllllllll_oooooooooo_nnnnnnnnnn_gggggggggg_ffffffffff_iiiiiiiiii_llllllllll_eeeeeeeeee_nnnnnnnnnn_aaaaaaaaaa_mmmmmmmmmm_eeeeeeeeee.txt") diff --git a/Tests/RunCMake/CPack/tests/MAIN_COMPONENT/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/MAIN_COMPONENT/ExpectedFiles.cmake index 6bfb0c1..629be9e 100644 --- a/Tests/RunCMake/CPack/tests/MAIN_COMPONENT/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/MAIN_COMPONENT/ExpectedFiles.cmake @@ -3,9 +3,9 @@ set(EXPECTED_FILES_COUNT "0") if(NOT RunCMake_SUBTEST_SUFFIX STREQUAL "invalid") set(EXPECTED_FILES_COUNT "3") set(EXPECTED_FILE_1 "main_component-0.1.1-1.*.rpm") - set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") + set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") set(EXPECTED_FILE_2_COMPONENT "headers") - set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/bar;/usr/bar/CMakeLists.txt") + set(EXPECTED_FILE_CONTENT_2_LIST "/bar;/bar/CMakeLists.txt") set(EXPECTED_FILE_3_COMPONENT "libs") - set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/bas;/usr/bas/CMakeLists.txt") + set(EXPECTED_FILE_CONTENT_3_LIST "/bas;/bas/CMakeLists.txt") endif() diff --git a/Tests/RunCMake/CPack/tests/MD5SUMS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/MD5SUMS/ExpectedFiles.cmake index 6142eb3..d1a3a5f 100644 --- a/Tests/RunCMake/CPack/tests/MD5SUMS/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/MD5SUMS/ExpectedFiles.cmake @@ -1,2 +1,2 @@ set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/MINIMAL/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/MINIMAL/ExpectedFiles.cmake index 6142eb3..d1a3a5f 100644 --- a/Tests/RunCMake/CPack/tests/MINIMAL/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/MINIMAL/ExpectedFiles.cmake @@ -1,2 +1,2 @@ set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/ExpectedFiles.cmake index eed5b92..c375aca 100644 --- a/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/ExpectedFiles.cmake @@ -2,5 +2,5 @@ set(EXPECTED_FILES_COUNT "0") if(NOT ${RunCMake_SUBTEST_SUFFIX} MATCHES "invalid") set(EXPECTED_FILES_COUNT "1") - set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") + set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") endif() diff --git a/Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/ExpectedFiles.cmake index ae58c4b..137da47 100644 --- a/Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/ExpectedFiles.cmake @@ -1,2 +1,4 @@ set(EXPECTED_FILES_COUNT "1") +# don't set the prefix here as we have absolute paths that should not be prefixed +set(EXPECTED_FILE_PACKAGING_PREFIX "") set(EXPECTED_FILE_CONTENT_1_LIST "/not_relocatable;/not_relocatable/CMakeLists.txt;/opt") diff --git a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/ExpectedFiles.cmake index 9bdb176..26fa1df 100644 --- a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/ExpectedFiles.cmake @@ -1,8 +1,8 @@ set(EXPECTED_FILES_COUNT "3") set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) set(EXPECTED_FILE_1_COMPONENT "pkg_1") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") set(EXPECTED_FILE_2_NAME "second") -set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_2_LIST "/foo;/foo/CMakeLists.txt") set(EXPECTED_FILE_3_COMPONENT "pkg_3") -set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_3_LIST "/foo;/foo/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/ExpectedFiles.cmake index ca866ea..8170d39 100644 --- a/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/ExpectedFiles.cmake @@ -5,25 +5,25 @@ set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid" OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_debuginfo") set(EXPECTED_FILES_COUNT "4") set(EXPECTED_FILE_1 "single_debuginfo-0.1.1-1.*.rpm") - set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/test_prog") + set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/test_prog") set(EXPECTED_FILE_2 "single_debuginfo*-headers.rpm") - set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/bar;/usr/bar/CMakeLists.txt") + set(EXPECTED_FILE_CONTENT_2_LIST "/bar;/bar/CMakeLists.txt") set(EXPECTED_FILE_3 "single_debuginfo*-libs.rpm") - set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/bas;/usr/bas/libtest_lib.so") + set(EXPECTED_FILE_CONTENT_3_LIST "/bas;/bas/libtest_lib.so") set(EXPECTED_FILE_4_COMPONENT "debuginfo") set(EXPECTED_FILE_CONTENT_4 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp${whitespaces_}/src/src_1/test_lib.cpp.*") elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "one_component" OR RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_no_debuginfo") set(EXPECTED_FILES_COUNT "2") set(EXPECTED_FILE_1 "single_debuginfo-0*-applications.rpm") - set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/test_prog") + set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/test_prog") set(EXPECTED_FILE_2 "single_debuginfo-applications-debuginfo*.rpm") set(EXPECTED_FILE_CONTENT_2 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*") elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_main" OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_components") set(EXPECTED_FILES_COUNT "2") set(EXPECTED_FILE_1 "single_debuginfo-0*.rpm") - set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/test_prog") + set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/test_prog") set(EXPECTED_FILE_2 "single_debuginfo-debuginfo*.rpm") set(EXPECTED_FILE_CONTENT_2 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*") diff --git a/Tests/RunCMake/CPack/tests/SOURCE_PACKAGE/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/SOURCE_PACKAGE/ExpectedFiles.cmake index 0a3e426..d78f222 100644 --- a/Tests/RunCMake/CPack/tests/SOURCE_PACKAGE/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/SOURCE_PACKAGE/ExpectedFiles.cmake @@ -1,2 +1,3 @@ set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_PACKAGING_PREFIX "") set(EXPECTED_FILE_CONTENT_1_LIST "source_package-0.1.1.tar.gz;source_package.spec") diff --git a/Tests/RunCMake/CPack/tests/SUGGESTS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/SUGGESTS/ExpectedFiles.cmake index 6142eb3..d1a3a5f 100644 --- a/Tests/RunCMake/CPack/tests/SUGGESTS/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/SUGGESTS/ExpectedFiles.cmake @@ -1,2 +1,2 @@ set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/SYMLINKS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/SYMLINKS/ExpectedFiles.cmake index 05be748..e8281a8 100644 --- a/Tests/RunCMake/CPack/tests/SYMLINKS/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/SYMLINKS/ExpectedFiles.cmake @@ -1,12 +1,11 @@ set(EXPECTED_FILES_COUNT "1") set(EXPECTED_FILE_CONTENT_1_LIST - "/usr" - "/usr/empty_dir" - "/usr/non_empty_dir" - "/usr/non_empty_dir/CMakeLists.txt" - "/usr/symlink_to_empty_dir" - "/usr/symlink_to_non_empty_dir") + "/empty_dir" + "/non_empty_dir" + "/non_empty_dir/CMakeLists.txt" + "/symlink_to_empty_dir" + "/symlink_to_non_empty_dir") if(PACKAGING_TYPE STREQUAL "COMPONENT") set(EXPECTED_FILE_1_COMPONENT "links") diff --git a/Tests/RunCMake/CPack/tests/USER_FILELIST/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/USER_FILELIST/ExpectedFiles.cmake index aabe537..8420986 100644 --- a/Tests/RunCMake/CPack/tests/USER_FILELIST/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/USER_FILELIST/ExpectedFiles.cmake @@ -1,2 +1,2 @@ set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr/one;/usr/one/foo.txt;/usr/one/two;/usr/one/two/bar.txt;/usr/three;/usr/three/baz.txt;/usr/three/qux.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/one;/one/foo.txt;/one/two;/one/two/bar.txt;/three;/three/baz.txt;/three/qux.txt") diff --git a/Tests/RunCMake/CPack/tests/VERSION/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/VERSION/ExpectedFiles.cmake index 85c571c..372f71b 100644 --- a/Tests/RunCMake/CPack/tests/VERSION/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/VERSION/ExpectedFiles.cmake @@ -1,3 +1,3 @@ set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") set(EXPECTED_FILE_1_REVISION "1") diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index e936dab..0fafea5 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -102,7 +102,7 @@ function(run_TestLoad name load) add_test(TestLoad1 \"${CMAKE_COMMAND}\" -E echo \"test of --test-load\") add_test(TestLoad2 \"${CMAKE_COMMAND}\" -E echo \"test of --test-load\") ") - run_cmake_command(${name} ${CMAKE_CTEST_COMMAND} -j2 --test-load ${load} --test-timeout 5) + run_cmake_command(${name} ${CMAKE_CTEST_COMMAND} -j2 --test-load ${load}) endfunction() # Tests for the --test-load feature of ctest diff --git a/Tests/RunCMake/CompilerLauncher/Fortran-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/Fortran-Build-stdout.txt new file mode 100644 index 0000000..3313e31 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/Fortran-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/Fortran-launch-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/Fortran-launch-Build-stdout.txt new file mode 100644 index 0000000..3313e31 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/Fortran-launch-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/Fortran-launch.cmake b/Tests/RunCMake/CompilerLauncher/Fortran-launch.cmake new file mode 100644 index 0000000..7e9a564 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/Fortran-launch.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(Fortran.cmake) diff --git a/Tests/RunCMake/CompilerLauncher/Fortran.cmake b/Tests/RunCMake/CompilerLauncher/Fortran.cmake new file mode 100644 index 0000000..72cc03e --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/Fortran.cmake @@ -0,0 +1,4 @@ +enable_language(Fortran) +set(CMAKE_Fortran_COMPILER_LAUNCHER "${CMAKE_COMMAND};-E;env;USED_LAUNCHER=1") +set(CMAKE_VERBOSE_MAKEFILE TRUE) +add_executable(main main.F) diff --git a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake index ab26512..bb8da03 100644 --- a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake +++ b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake @@ -19,6 +19,9 @@ set(langs C CXX) if(CMake_TEST_CUDA) list(APPEND langs CUDA) endif() +if(CMake_TEST_Fortran) + list(APPEND langs Fortran) +endif() foreach(lang ${langs}) run_compiler_launcher(${lang}) diff --git a/Tests/RunCMake/CompilerLauncher/main.F b/Tests/RunCMake/CompilerLauncher/main.F new file mode 100644 index 0000000..53ec0d1 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/main.F @@ -0,0 +1,2 @@ + PROGRAM MAIN + END diff --git a/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake index 59ccf19..bead2af 100644 --- a/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake +++ b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake @@ -1,12 +1,6 @@ - enable_language(CXX C) -add_library(empty empty.cpp empty.c) -target_compile_options(empty - PRIVATE LANG_IS_$<COMPILE_LANGUAGE> -) - file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/opts-$<COMPILE_LANGUAGE>.txt - CONTENT "$<TARGET_PROPERTY:empty,COMPILE_OPTIONS>\n" + CONTENT "LANG_IS_$<COMPILE_LANGUAGE>\n" ) diff --git a/Tests/RunCMake/File_Generate/CarryPermissions-result.txt b/Tests/RunCMake/File_Generate/CarryPermissions-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/File_Generate/CarryPermissions-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/File_Generate/GenerateSource-result.txt b/Tests/RunCMake/File_Generate/GenerateSource-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/File_Generate/GenerateSource-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/File_Generate/OutputNameMatchesOtherSources-result.txt b/Tests/RunCMake/File_Generate/OutputNameMatchesOtherSources-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/File_Generate/OutputNameMatchesOtherSources-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/File_Generate/ReRunCMake-result.txt b/Tests/RunCMake/File_Generate/ReRunCMake-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/File_Generate/ReRunCMake-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake index b660463..616e210 100644 --- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake @@ -21,15 +21,13 @@ if (NOT file_contents MATCHES "generated.cpp.rule") message(SEND_ERROR "Rule file not in target sources! ${file_contents}") endif() -if (NOT RunCMake_GENERATOR MATCHES "Visual Studio") - run_cmake(COMPILE_LANGUAGE-genex) - foreach(l CXX C) - file(READ "${RunCMake_BINARY_DIR}/COMPILE_LANGUAGE-genex-build/opts-${l}.txt" l_defs) - if (NOT l_defs STREQUAL "LANG_IS_${l}\n") - message(FATAL_ERROR "File content does not match: ${l_defs}") - endif() - endforeach() -endif() +run_cmake(COMPILE_LANGUAGE-genex) +foreach(l CXX C) + file(READ "${RunCMake_BINARY_DIR}/COMPILE_LANGUAGE-genex-build/opts-${l}.txt" l_defs) + if (NOT l_defs STREQUAL "LANG_IS_${l}\n") + message(FATAL_ERROR "File content does not match: ${l_defs}") + endif() +endforeach() set(timeformat "%Y%j%H%M%S") diff --git a/Tests/RunCMake/File_Generate/WriteIfDifferent-result.txt b/Tests/RunCMake/File_Generate/WriteIfDifferent-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/File_Generate/WriteIfDifferent-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/FindOpenGL/CMP0072-NEW-stdout.txt b/Tests/RunCMake/FindOpenGL/CMP0072-NEW-stdout.txt new file mode 100644 index 0000000..f5ee220 --- /dev/null +++ b/Tests/RunCMake/FindOpenGL/CMP0072-NEW-stdout.txt @@ -0,0 +1,3 @@ +-- OpenGL_GL_PREFERENCE='GLVND' +-- OPENGL_gl_LIBRARY='' +-- OPENGL_LIBRARIES='OpenGL;GLX;GLU' diff --git a/Tests/RunCMake/FindOpenGL/CMP0072-NEW.cmake b/Tests/RunCMake/FindOpenGL/CMP0072-NEW.cmake new file mode 100644 index 0000000..6cbbeec --- /dev/null +++ b/Tests/RunCMake/FindOpenGL/CMP0072-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0072 NEW) +include(CMP0072-common.cmake) diff --git a/Tests/RunCMake/FindOpenGL/CMP0072-OLD-stdout.txt b/Tests/RunCMake/FindOpenGL/CMP0072-OLD-stdout.txt new file mode 100644 index 0000000..22df1b1 --- /dev/null +++ b/Tests/RunCMake/FindOpenGL/CMP0072-OLD-stdout.txt @@ -0,0 +1,3 @@ +-- OpenGL_GL_PREFERENCE='LEGACY' +-- OPENGL_gl_LIBRARY='GL' +-- OPENGL_LIBRARIES='GL;GLU' diff --git a/Tests/RunCMake/FindOpenGL/CMP0072-OLD.cmake b/Tests/RunCMake/FindOpenGL/CMP0072-OLD.cmake new file mode 100644 index 0000000..6d57004 --- /dev/null +++ b/Tests/RunCMake/FindOpenGL/CMP0072-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0072 OLD) +include(CMP0072-common.cmake) diff --git a/Tests/RunCMake/FindOpenGL/CMP0072-WARN-stderr.txt b/Tests/RunCMake/FindOpenGL/CMP0072-WARN-stderr.txt new file mode 100644 index 0000000..f26f217 --- /dev/null +++ b/Tests/RunCMake/FindOpenGL/CMP0072-WARN-stderr.txt @@ -0,0 +1,21 @@ +^CMake Warning \(dev\) at .*/Modules/FindOpenGL.cmake:[0-9]+ \(message\): + Policy CMP0072 is not set: FindOpenGL prefers GLVND by default when + available. Run "cmake --help-policy CMP0072" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + FindOpenGL found both a legacy GL library: + + OPENGL_gl_LIBRARY: GL + + and GLVND libraries for OpenGL and GLX: + + OPENGL_opengl_LIBRARY: OpenGL + OPENGL_glx_LIBRARY: GLX + + OpenGL_GL_PREFERENCE has not been set to "GLVND" or "LEGACY", so for + compatibility with CMake 3.10 and below the legacy GL library will be used. +Call Stack \(most recent call first\): + CMP0072-common.cmake:[0-9]+ \(find_package\) + CMP0072-WARN.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/FindOpenGL/CMP0072-WARN-stdout.txt b/Tests/RunCMake/FindOpenGL/CMP0072-WARN-stdout.txt new file mode 100644 index 0000000..22df1b1 --- /dev/null +++ b/Tests/RunCMake/FindOpenGL/CMP0072-WARN-stdout.txt @@ -0,0 +1,3 @@ +-- OpenGL_GL_PREFERENCE='LEGACY' +-- OPENGL_gl_LIBRARY='GL' +-- OPENGL_LIBRARIES='GL;GLU' diff --git a/Tests/RunCMake/FindOpenGL/CMP0072-WARN.cmake b/Tests/RunCMake/FindOpenGL/CMP0072-WARN.cmake new file mode 100644 index 0000000..459c458 --- /dev/null +++ b/Tests/RunCMake/FindOpenGL/CMP0072-WARN.cmake @@ -0,0 +1 @@ +include(CMP0072-common.cmake) diff --git a/Tests/RunCMake/FindOpenGL/CMP0072-common.cmake b/Tests/RunCMake/FindOpenGL/CMP0072-common.cmake new file mode 100644 index 0000000..3fe8030 --- /dev/null +++ b/Tests/RunCMake/FindOpenGL/CMP0072-common.cmake @@ -0,0 +1,13 @@ +set(CYGWIN 0) +set(WIN32 0) +set(APPLE 0) +set(OPENGL_INCLUDE_DIR GL/include) +set(OPENGL_GLX_INCLUDE_DIR GLX/include) +set(OPENGL_gl_LIBRARY GL) +set(OPENGL_opengl_LIBRARY OpenGL) +set(OPENGL_glx_LIBRARY GLX) +set(OPENGL_glu_LIBRARY GLU) +find_package(OpenGL) +message(STATUS "OpenGL_GL_PREFERENCE='${OpenGL_GL_PREFERENCE}'") +message(STATUS "OPENGL_gl_LIBRARY='${OPENGL_gl_LIBRARY}'") +message(STATUS "OPENGL_LIBRARIES='${OPENGL_LIBRARIES}'") diff --git a/Tests/RunCMake/FindOpenGL/CMakeLists.txt b/Tests/RunCMake/FindOpenGL/CMakeLists.txt new file mode 100644 index 0000000..bf2ef15 --- /dev/null +++ b/Tests/RunCMake/FindOpenGL/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.10) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/FindOpenGL/RunCMakeTest.cmake b/Tests/RunCMake/FindOpenGL/RunCMakeTest.cmake new file mode 100644 index 0000000..fcc130f --- /dev/null +++ b/Tests/RunCMake/FindOpenGL/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(CMP0072-WARN) +run_cmake(CMP0072-OLD) +run_cmake(CMP0072-NEW) diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt index 5f7753d..5f7753d 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTest-test-stdout.txt +++ b/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt new file mode 100644 index 0000000..960c0b9 --- /dev/null +++ b/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt @@ -0,0 +1,25 @@ +Test project .* + Start 9: TEST:basic\.case_foo!2 +1/8 Test #9: TEST:basic\.case_foo!2 \.+ +Passed +[0-9.]+ sec + Start 10: TEST:basic\.case_bar!2 +2/8 Test #10: TEST:basic\.case_bar!2 \.+ +Passed +[0-9.]+ sec + Start 11: TEST:basic\.disabled_case!2 +3/8 Test #11: TEST:basic\.disabled_case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec + Start 12: TEST:disabled\.case!2 +4/8 Test #12: TEST:disabled\.case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec + Start 13: TEST:typed/short\.case!2 +5/8 Test #13: TEST:typed/short\.case!2 \.+ +Passed +[0-9.]+ sec + Start 14: TEST:typed/float\.case!2 +6/8 Test #14: TEST:typed/float\.case!2 \.+ +Passed +[0-9.]+ sec + Start 15: TEST:value/test\.case/1!2 +7/8 Test #15: TEST:value/test\.case/1!2 \.+ +Passed +[0-9.]+ sec + Start 16: TEST:value/test\.case/"foo"!2 +8/8 Test #16: TEST:value/test\.case/"foo"!2 \.+ +Passed +[0-9.]+ sec + +100% tests passed, 0 tests failed out of 6 + +Total Test time \(real\) = +[0-9.]+ sec + +The following tests did not run: +.*11 - TEST:basic\.disabled_case!2 \(Disabled\) +.*12 - TEST:disabled\.case!2 \(Disabled\) diff --git a/Tests/RunCMake/GoogleTest/GoogleTest.cmake b/Tests/RunCMake/GoogleTest/GoogleTest.cmake index 9a3677f..58f4196 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTest.cmake +++ b/Tests/RunCMake/GoogleTest/GoogleTest.cmake @@ -11,5 +11,13 @@ gtest_discover_tests( TEST_PREFIX TEST: TEST_SUFFIX !1 EXTRA_ARGS how now "\"brown\" cow" - PROPERTIES LABELS TEST + PROPERTIES LABELS TEST1 +) + +gtest_discover_tests( + fake_gtest + TEST_PREFIX TEST: + TEST_SUFFIX !2 + EXTRA_ARGS how now "\"brown\" cow" + PROPERTIES LABELS TEST2 ) diff --git a/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake b/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake index aec8568..b79af26 100644 --- a/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake +++ b/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake @@ -15,10 +15,16 @@ function(run_GoogleTest) --build . --config Debug ) - run_cmake_command(GoogleTest-test + run_cmake_command(GoogleTest-test1 ${CMAKE_CTEST_COMMAND} -C Debug - -L TEST + -L TEST1 + --no-label-summary + ) + run_cmake_command(GoogleTest-test2 + ${CMAKE_CTEST_COMMAND} + -C Debug + -L TEST2 --no-label-summary ) endfunction() diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-result.txt b/Tests/RunCMake/foreach/BadRangeInFunction-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-result.txt +++ b/Tests/RunCMake/foreach/BadRangeInFunction-result.txt diff --git a/Tests/RunCMake/foreach/BadRangeInFunction-stderr.txt b/Tests/RunCMake/foreach/BadRangeInFunction-stderr.txt new file mode 100644 index 0000000..e16a0f1 --- /dev/null +++ b/Tests/RunCMake/foreach/BadRangeInFunction-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at BadRangeInFunction.cmake:2 \(foreach\): + foreach called with incorrect range specification: start 2, stop 1, step 1 +Call Stack \(most recent call first\): + BadRangeInFunction.cmake:5 \(func\) + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/foreach/BadRangeInFunction.cmake b/Tests/RunCMake/foreach/BadRangeInFunction.cmake new file mode 100644 index 0000000..f51cbbf --- /dev/null +++ b/Tests/RunCMake/foreach/BadRangeInFunction.cmake @@ -0,0 +1,5 @@ +function(func) + foreach(bad_range RANGE 2 1 1) + endforeach() +endfunction() +func() diff --git a/Tests/RunCMake/foreach/CMakeLists.txt b/Tests/RunCMake/foreach/CMakeLists.txt new file mode 100644 index 0000000..bf2ef15 --- /dev/null +++ b/Tests/RunCMake/foreach/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.10) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/foreach/RunCMakeTest.cmake b/Tests/RunCMake/foreach/RunCMakeTest.cmake new file mode 100644 index 0000000..4b74cfe --- /dev/null +++ b/Tests/RunCMake/foreach/RunCMakeTest.cmake @@ -0,0 +1,3 @@ +include(RunCMake) + +run_cmake(BadRangeInFunction) 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 |