summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/BuildDepends/ExternalProject/CMakeLists.txt14
-rw-r--r--Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build1-stdout.txt2
-rw-r--r--Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build2-stdout.txt2
-rw-r--r--Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.cmake19
-rw-r--r--Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step1.cmake3
-rw-r--r--Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step2.cmake3
-rw-r--r--Tests/RunCMake/BuildDepends/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake22
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/Install-all-install-ninja-check.cmake39
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/Install-default-install-ninja-check.cmake31
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/PrecompileHeaders/PchInterface.cmake3
12 files changed, 147 insertions, 2 deletions
diff --git a/Tests/RunCMake/BuildDepends/ExternalProject/CMakeLists.txt b/Tests/RunCMake/BuildDepends/ExternalProject/CMakeLists.txt
new file mode 100644
index 0000000..57a0f6e
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/ExternalProject/CMakeLists.txt
@@ -0,0 +1,14 @@
+cmake_minimum_required(VERSION 3.12)
+project(External NONE)
+
+if (DEFINED cache_arg)
+ message("configured with: ${cache_arg}")
+else ()
+ message("cache_arg is undefined")
+endif ()
+
+if (DEFINED second_cache_arg)
+ message("configured again with: ${second_cache_arg}")
+else ()
+ message("second_cache_arg is undefined")
+endif ()
diff --git a/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build1-stdout.txt b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build1-stdout.txt
new file mode 100644
index 0000000..fea7fd9
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build1-stdout.txt
@@ -0,0 +1,2 @@
+.*configured with: first
+.*second_cache_arg is undefined
diff --git a/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build2-stdout.txt b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build2-stdout.txt
new file mode 100644
index 0000000..e19e743
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build2-stdout.txt
@@ -0,0 +1,2 @@
+.*configured with: first
+.*configured again with: second
diff --git a/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.cmake b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.cmake
new file mode 100644
index 0000000..fe69426
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.cmake
@@ -0,0 +1,19 @@
+include("${CMAKE_CURRENT_BINARY_DIR}/data.cmake")
+
+include(ExternalProject)
+ExternalProject_add(external
+ SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/ExternalProject"
+ CMAKE_CACHE_ARGS
+ ${cache_args}
+ BUILD_COMMAND ""
+ INSTALL_COMMAND "")
+
+set(cache_args_path "<TMP_DIR>/external-cache-$<CONFIG>.cmake")
+set(cmake_cache_path "<BINARY_DIR>/CMakeCache.txt")
+_ep_replace_location_tags(external cache_args_path cmake_cache_path)
+
+file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/check-$<LOWER_CASE:$<CONFIG>>.cmake" CONTENT "
+set(check_pairs
+ \"${cmake_cache_path}|${cache_args_path}\"
+)
+")
diff --git a/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step1.cmake b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step1.cmake
new file mode 100644
index 0000000..57c7ab7
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step1.cmake
@@ -0,0 +1,3 @@
+file(WRITE "${RunCMake_TEST_BINARY_DIR}/data.cmake"
+ "set(cache_args -Dcache_arg:STRING=first)
+")
diff --git a/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step2.cmake b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step2.cmake
new file mode 100644
index 0000000..cbb79e1
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step2.cmake
@@ -0,0 +1,3 @@
+file(WRITE "${RunCMake_TEST_BINARY_DIR}/data.cmake"
+ "set(cache_args -Dsecond_cache_arg:STRING=second)
+")
diff --git a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
index 14ae243..e4d7177 100644
--- a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
+++ b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
@@ -46,6 +46,11 @@ endif()
run_BuildDepends(Custom-Symbolic-and-Byproduct)
run_BuildDepends(Custom-Always)
+set(RunCMake_TEST_OUTPUT_MERGE_save "${RunCMake_TEST_OUTPUT_MERGE}")
+set(RunCMake_TEST_OUTPUT_MERGE 1)
+run_BuildDepends(ExternalProjectCacheArgs)
+set(RunCMake_TEST_OUTPUT_MERGE "${RunCMake_TEST_OUTPUT_MERGE_save}")
+
# Test header dependencies with a build tree underneath a source tree.
set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/BuildUnderSource")
set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/BuildUnderSource/build")
diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake
index 62bb5de..d697fc6 100644
--- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake
+++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake
@@ -99,6 +99,7 @@ file(WRITE ${fakePkgDir}/lib/pkgconfig/${pname}.pc
Description: Dummy package for FindPkgConfig IMPORTED_TARGET INTERFACE_LINK_OPTIONS test
Version: 1.2.3
Libs: -e dummy_main
+Cflags: -I/special -isystem /other -isystem/more -DA-isystem/foo
")
set(expected_link_options -e dummy_main)
@@ -109,7 +110,26 @@ endif()
get_target_property(link_options PkgConfig::FakeLinkOptionsPackage INTERFACE_LINK_OPTIONS)
if (NOT link_options STREQUAL expected_link_options)
message(FATAL_ERROR
- "Additional link options not present in INTERFACE_LINK_OPTIONS property"
+ "Additional link options not present in INTERFACE_LINK_OPTIONS property\n"
"expected: \"${expected_link_options}\", but got \"${link_options}\""
)
endif()
+
+get_target_property(inc_dirs PkgConfig::FakeLinkOptionsPackage INTERFACE_INCLUDE_DIRECTORIES)
+set(expected_inc_dirs "/special" "/other" "/more")
+
+if (NOT inc_dirs STREQUAL expected_inc_dirs)
+ message(FATAL_ERROR
+ "Additional include directories not correctly present in INTERFACE_INCLUDE_DIRECTORIES property\n"
+ "expected: \"${expected_inc_dirs}\", got \"${inc_dirs}\""
+ )
+endif ()
+
+get_target_property(c_opts PkgConfig::FakeLinkOptionsPackage INTERFACE_COMPILE_OPTIONS)
+set(expected_c_opts "-DA-isystem/foo") # this is an invalid option, but a good testcase
+if (NOT c_opts STREQUAL expected_c_opts)
+ message(FATAL_ERROR
+ "Additional compile options not present in INTERFACE_COMPILE_OPTIONS property\n"
+ "expected: \"${expected_c_opts}\", got \"${c_opts}\""
+ )
+endif ()
diff --git a/Tests/RunCMake/NinjaMultiConfig/Install-all-install-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Install-all-install-ninja-check.cmake
new file mode 100644
index 0000000..c588aac
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/Install-all-install-ninja-check.cmake
@@ -0,0 +1,39 @@
+check_files("${RunCMake_TEST_BINARY_DIR}"
+ INCLUDE
+ ${TARGET_FILE_exe_Debug}
+ ${TARGET_OBJECT_FILES_exe_Debug}
+
+ ${TARGET_FILE_mylib_Release}
+ ${TARGET_LINKER_FILE_mylib_Debug}
+ ${TARGET_OBJECT_FILES_mylib_Debug}
+
+ ${RunCMake_TEST_BINARY_DIR}/install/bin/Debug/${TARGET_FILE_NAME_exe_Debug}
+ ${RunCMake_TEST_BINARY_DIR}/install/lib/Debug/${TARGET_FILE_NAME_mylib_Debug}
+ ${RunCMake_TEST_BINARY_DIR}/install/lib/Debug/${TARGET_LINKER_FILE_NAME_mylib_Debug}
+
+ ${TARGET_FILE_exe_Release}
+ ${TARGET_OBJECT_FILES_exe_Release}
+
+ ${TARGET_FILE_mylib_Release}
+ ${TARGET_LINKER_FILE_mylib_Release}
+ ${TARGET_OBJECT_FILES_mylib_Release}
+
+ ${RunCMake_TEST_BINARY_DIR}/install/bin/Release/${TARGET_FILE_NAME_exe_Release}
+ ${RunCMake_TEST_BINARY_DIR}/install/lib/Release/${TARGET_FILE_NAME_mylib_Release}
+ ${RunCMake_TEST_BINARY_DIR}/install/lib/Release/${TARGET_LINKER_FILE_NAME_mylib_Release}
+
+ ${TARGET_FILE_exe_RelWithDebInfo}
+ ${TARGET_OBJECT_FILES_exe_RelWithDebInfo}
+
+ ${TARGET_FILE_mylib_RelWithDebInfo}
+ ${TARGET_LINKER_FILE_mylib_RelWithDebInfo}
+ ${TARGET_OBJECT_FILES_mylib_RelWithDebInfo}
+
+ ${RunCMake_TEST_BINARY_DIR}/install/bin/RelWithDebInfo/${TARGET_FILE_NAME_exe_RelWithDebInfo}
+ ${RunCMake_TEST_BINARY_DIR}/install/lib/RelWithDebInfo/${TARGET_FILE_NAME_mylib_RelWithDebInfo}
+ ${RunCMake_TEST_BINARY_DIR}/install/lib/RelWithDebInfo/${TARGET_LINKER_FILE_NAME_mylib_RelWithDebInfo}
+
+ EXCLUDE
+ ${TARGET_OBJECT_FILES_exe_MinSizeRel}
+ ${TARGET_OBJECT_FILES_mylib_MinSizeRel}
+ )
diff --git a/Tests/RunCMake/NinjaMultiConfig/Install-default-install-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Install-default-install-ninja-check.cmake
new file mode 100644
index 0000000..bc15a25
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/Install-default-install-ninja-check.cmake
@@ -0,0 +1,31 @@
+check_files("${RunCMake_TEST_BINARY_DIR}"
+ INCLUDE
+ ${TARGET_FILE_exe_Debug}
+ ${TARGET_OBJECT_FILES_exe_Debug}
+
+ ${TARGET_FILE_mylib_Release}
+ ${TARGET_LINKER_FILE_mylib_Debug}
+ ${TARGET_OBJECT_FILES_mylib_Debug}
+
+ ${RunCMake_TEST_BINARY_DIR}/install/bin/Debug/${TARGET_FILE_NAME_exe_Debug}
+ ${RunCMake_TEST_BINARY_DIR}/install/lib/Debug/${TARGET_FILE_NAME_mylib_Debug}
+ ${RunCMake_TEST_BINARY_DIR}/install/lib/Debug/${TARGET_LINKER_FILE_NAME_mylib_Debug}
+
+ ${TARGET_FILE_exe_Release}
+ ${TARGET_OBJECT_FILES_exe_Release}
+
+ ${TARGET_FILE_mylib_Release}
+ ${TARGET_LINKER_FILE_mylib_Release}
+ ${TARGET_OBJECT_FILES_mylib_Release}
+
+ ${RunCMake_TEST_BINARY_DIR}/install/bin/Release/${TARGET_FILE_NAME_exe_Release}
+ ${RunCMake_TEST_BINARY_DIR}/install/lib/Release/${TARGET_FILE_NAME_mylib_Release}
+ ${RunCMake_TEST_BINARY_DIR}/install/lib/Release/${TARGET_LINKER_FILE_NAME_mylib_Release}
+
+ EXCLUDE
+ ${TARGET_OBJECT_FILES_exe_MinSizeRel}
+ ${TARGET_OBJECT_FILES_mylib_MinSizeRel}
+
+ ${TARGET_OBJECT_FILES_exe_RelWithDebInfo}
+ ${TARGET_OBJECT_FILES_mylib_RelWithDebInfo}
+ )
diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
index 6472f46..d4a08a9 100644
--- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
+++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
@@ -263,12 +263,16 @@ run_cmake_build(AdditionalCleanFiles release-clean Release clean)
run_ninja(AdditionalCleanFiles all-clean build-Debug.ninja clean:all)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Install-build)
-set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_TEST_BINARY_DIR}/install;-DCMAKE_CROSS_CONFIGS=all")
+set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_TEST_BINARY_DIR}/install;-DCMAKE_CROSS_CONFIGS=all;-DCMAKE_DEFAULT_CONFIGS=Debug\\;Release")
run_cmake_configure(Install)
unset(RunCMake_TEST_OPTIONS)
include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
run_cmake_build(Install release-install Release install)
run_ninja(Install debug-in-release-graph-install build-Release.ninja install:Debug)
+file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}/install")
+run_ninja(Install default-install build.ninja install)
+file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}/install")
+run_ninja(Install all-install build.ninja install:all)
# FIXME Get this working
#set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/AutoMocExecutable-build)
diff --git a/Tests/RunCMake/PrecompileHeaders/PchInterface.cmake b/Tests/RunCMake/PrecompileHeaders/PchInterface.cmake
index a1e0792..aab20d8 100644
--- a/Tests/RunCMake/PrecompileHeaders/PchInterface.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/PchInterface.cmake
@@ -9,6 +9,9 @@ target_precompile_headers(foo PUBLIC
<stdio.h>
\"string.h\"
)
+if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
+ set_property(SOURCE foo.c APPEND PROPERTY COMPILE_OPTIONS "-WX-")
+endif()
add_library(bar INTERFACE)
target_include_directories(bar INTERFACE include)