diff options
Diffstat (limited to 'Tests')
174 files changed, 2121 insertions, 121 deletions
diff --git a/Tests/CMakeLib/testUTF8.cxx b/Tests/CMakeLib/testUTF8.cxx index 986f595..1bf88cf 100644 --- a/Tests/CMakeLib/testUTF8.cxx +++ b/Tests/CMakeLib/testUTF8.cxx @@ -9,9 +9,11 @@ typedef char test_utf8_char[5]; static void test_utf8_char_print(test_utf8_char const c) { unsigned char const* d = reinterpret_cast<unsigned char const*>(c); +#ifndef __clang_analyzer__ // somehow thinks arguments are not initialized printf("[0x%02X,0x%02X,0x%02X,0x%02X]", static_cast<int>(d[0]), static_cast<int>(d[1]), static_cast<int>(d[2]), static_cast<int>(d[3])); +#endif } static void byte_array_print(char const* s) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index b29638b..185401f 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -451,8 +451,12 @@ if(BUILD_TESTING) ADD_TEST_MACRO(StagingPrefix StagingPrefix) ADD_TEST_MACRO(ImportedSameName ImportedSameName) ADD_TEST_MACRO(InterfaceLibrary InterfaceLibrary) - if(NOT _isMultiConfig) - set(ConfigSources_BUILD_OPTIONS -DCMAKE_BUILD_TYPE=$<CONFIGURATION>) + if(NOT CMAKE_GENERATOR STREQUAL "Xcode") + if(_isMultiConfig) + set(ConfigSources_CTEST_OPTIONS --build-config $<CONFIGURATION>) + else() + set(ConfigSources_BUILD_OPTIONS -DCMAKE_BUILD_TYPE=$<CONFIGURATION>) + endif() ADD_TEST_MACRO(ConfigSources ConfigSources) endif() ADD_TEST_MACRO(SourcesProperty SourcesProperty) diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt index 03babd2..85b9694 100644 --- a/Tests/CMakeOnly/CMakeLists.txt +++ b/Tests/CMakeOnly/CMakeLists.txt @@ -75,6 +75,12 @@ add_test(CMakeOnly.ProjectIncludeAny ${CMAKE_CMAKE_COMMAND} add_test(CMakeOnly.ProjectIncludeBefore ${CMAKE_CMAKE_COMMAND} -DTEST=ProjectIncludeBefore + -DCMAKE_ARGS=-DCMAKE_PROJECT_ProjectInclude_INCLUDE_BEFORE=${CMAKE_CURRENT_SOURCE_DIR}/ProjectIncludeBefore/include.cmake + -P ${CMAKE_CURRENT_BINARY_DIR}/Test.cmake + ) + +add_test(CMakeOnly.ProjectIncludeBeforeAny ${CMAKE_CMAKE_COMMAND} + -DTEST=ProjectIncludeBeforeAny -DCMAKE_ARGS=-DCMAKE_PROJECT_INCLUDE_BEFORE=${CMAKE_CURRENT_SOURCE_DIR}/ProjectIncludeBefore/include.cmake -P ${CMAKE_CURRENT_BINARY_DIR}/Test.cmake ) diff --git a/Tests/CMakeOnly/ProjectIncludeBeforeAny/CMakeLists.txt b/Tests/CMakeOnly/ProjectIncludeBeforeAny/CMakeLists.txt new file mode 100644 index 0000000..5cd9cba --- /dev/null +++ b/Tests/CMakeOnly/ProjectIncludeBeforeAny/CMakeLists.txt @@ -0,0 +1,5 @@ +set(FOO TRUE) +project(ProjectInclude LANGUAGES NONE) +if(NOT AUTO_INCLUDE) + message(FATAL_ERROR "include file not found") +endif() diff --git a/Tests/CMakeOnly/ProjectIncludeBeforeAny/include.cmake b/Tests/CMakeOnly/ProjectIncludeBeforeAny/include.cmake new file mode 100644 index 0000000..0a4799d --- /dev/null +++ b/Tests/CMakeOnly/ProjectIncludeBeforeAny/include.cmake @@ -0,0 +1,9 @@ +if(NOT FOO) + message(FATAL_ERROR "FOO is not set") +endif() + +if(NOT "${PROJECT_NAME}" STREQUAL "") + message(FATAL_ERROR "PROJECT_NAME should be empty") +endif() + +set(AUTO_INCLUDE TRUE) diff --git a/Tests/EnforceConfig.cmake.in b/Tests/EnforceConfig.cmake.in index b7587aa..7781ded 100644 --- a/Tests/EnforceConfig.cmake.in +++ b/Tests/EnforceConfig.cmake.in @@ -33,5 +33,6 @@ unset(ENV{CMAKE_GENERATOR}) unset(ENV{CMAKE_GENERATOR_INSTANCE}) unset(ENV{CMAKE_GENERATOR_PLATFORM}) unset(ENV{CMAKE_GENERATOR_TOOLSET}) +unset(ENV{CMAKE_EXPORT_COMPILE_COMMANDS}) @TEST_HOME_ENV_CODE@ diff --git a/Tests/ExportImport/Import/Interface/pch_iface_test.cpp b/Tests/ExportImport/Import/Interface/pch_iface_test.cpp index a460d0d..a18bbde 100644 --- a/Tests/ExportImport/Import/Interface/pch_iface_test.cpp +++ b/Tests/ExportImport/Import/Interface/pch_iface_test.cpp @@ -3,7 +3,7 @@ # ifndef PCH_PCH_H_INCLUDED # error "Expected PCH_PCH_H_INCLUDED." # endif -#elif defined(__PGIC__) || defined(__ibmxl__) +#elif defined(__PGIC__) || defined(__ibmxl__) || defined(_CRAYC) // No PCH expected but these compilers define macros below. #elif defined(__GNUC__) || defined(__clang__) || defined(_INTEL_COMPILER) || \ defined(_MSC_VER) diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt index 093391e..ef81169 100644 --- a/Tests/ExternalProject/CMakeLists.txt +++ b/Tests/ExternalProject/CMakeLists.txt @@ -482,6 +482,66 @@ if(do_git_tests) ) set_property(TARGET ${proj} PROPERTY FOLDER "GIT") + # Unzip/untar the git repository in our source folder so that other + # projects below may use it to test git args of ExternalProject_Add + # + set(proj SetupLocalGITRepositoryWithRecursiveSubmodules) + ExternalProject_Add(${proj} + SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/LocalRepositories/GIT-with-recursive-submodules + URL ${CMAKE_CURRENT_SOURCE_DIR}/gitrepo-sub-rec.tgz + BUILD_COMMAND "" + CONFIGURE_COMMAND "${GIT_EXECUTABLE}" --version + INSTALL_COMMAND "" + ) + set_property(TARGET ${proj} + PROPERTY FOLDER "SetupRepos/Local/Deeply/Nested/For/Testing") + + set(local_git_repo "../../LocalRepositories/GIT-with-recursive-submodules") + + set(proj TS1-GIT-RECURSIVE_SUBMODULES-default) + ExternalProject_Add(${proj} + GIT_REPOSITORY "${local_git_repo}" + CMAKE_GENERATOR "${CMAKE_GENERATOR}" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> + -DWITH_RECURSIVE:BOOL=ON + BUILD_COMMAND "" + INSTALL_COMMAND "" + DEPENDS "SetupLocalGITRepository" + "SetupLocalGITRepositoryWithSubmodules" + "SetupLocalGITRepositoryWithRecursiveSubmodules" + ) + set_property(TARGET ${proj} PROPERTY FOLDER "GIT") + + set(proj TS1-GIT-RECURSIVE_SUBMODULES-exclusive) + ExternalProject_Add(${proj} + GIT_REPOSITORY "${local_git_repo}" + GIT_SUBMODULES_RECURSE TRUE + CMAKE_GENERATOR "${CMAKE_GENERATOR}" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> + -DWITH_RECURSIVE:BOOL=ON + BUILD_COMMAND "" + INSTALL_COMMAND "" + DEPENDS "SetupLocalGITRepository" + "SetupLocalGITRepositoryWithSubmodules" + "SetupLocalGITRepositoryWithRecursiveSubmodules" + ) + set_property(TARGET ${proj} PROPERTY FOLDER "GIT") + + set(proj TS1-GIT-RECURSIVE_SUBMODULES-off) + ExternalProject_Add(${proj} + GIT_REPOSITORY "${local_git_repo}" + GIT_SUBMODULES_RECURSE FALSE + CMAKE_GENERATOR "${CMAKE_GENERATOR}" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> + -DWITH_RECURSIVE:BOOL=OFF + BUILD_COMMAND "" + INSTALL_COMMAND "" + DEPENDS "SetupLocalGITRepository" + "SetupLocalGITRepositoryWithSubmodules" + "SetupLocalGITRepositoryWithRecursiveSubmodules" + ) + set_property(TARGET ${proj} PROPERTY FOLDER "GIT") + endif() set(do_hg_tests 0) diff --git a/Tests/ExternalProject/gitrepo-sub-rec.tgz b/Tests/ExternalProject/gitrepo-sub-rec.tgz Binary files differnew file mode 100644 index 0000000..b0f3f18 --- /dev/null +++ b/Tests/ExternalProject/gitrepo-sub-rec.tgz diff --git a/Tests/FindPackageModeMakefileTest/CMakeLists.txt b/Tests/FindPackageModeMakefileTest/CMakeLists.txt index 23832da..8a87a8c 100644 --- a/Tests/FindPackageModeMakefileTest/CMakeLists.txt +++ b/Tests/FindPackageModeMakefileTest/CMakeLists.txt @@ -19,6 +19,14 @@ if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Makefile" AND # configure a FindFoo.cmake so it knows where the library can be found configure_file(FindFoo.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FindFoo.cmake @ONLY) + # Need the -isysroot flag on recentish macOS after command line tools + # no longer provide headers in /usr/include + if(APPLE AND CMAKE_OSX_SYSROOT) + set(__EXTRA_OSX_SYSROOT_FLAGS "-isysroot ${CMAKE_OSX_SYSROOT}") + else() + set(__EXTRA_OSX_SYSROOT_FLAGS "") + endif() + # now set up the test: file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cmakeExecutable.mk" CONTENT "CMAKE = \"$<TARGET_FILE:cmake>\"\n" diff --git a/Tests/FindPackageModeMakefileTest/Makefile.in b/Tests/FindPackageModeMakefileTest/Makefile.in index 8e7ff72..5ef67d0 100644 --- a/Tests/FindPackageModeMakefileTest/Makefile.in +++ b/Tests/FindPackageModeMakefileTest/Makefile.in @@ -5,6 +5,7 @@ CMAKE_CURRENT_BINARY_DIR = "@CMAKE_CURRENT_BINARY_DIR@" CMAKE_CXX_COMPILER = "@CMAKE_CXX_COMPILER@" CMAKE_CXX_COMPILER_ID = "@CMAKE_CXX_COMPILER_ID@" CMAKE_CXX_FLAGS = @CMAKE_CXX_FLAGS@ +__EXTRA_OSX_SYSROOT_FLAGS = @__EXTRA_OSX_SYSROOT_FLAGS@ CMAKE_FOO = $(CMAKE) --find-package -DCMAKE_MODULE_PATH=$(CMAKE_CURRENT_BINARY_DIR) -DNAME=Foo -DLANGUAGE=CXX -DCOMPILER_ID=$(CMAKE_CXX_COMPILER_ID) @@ -15,7 +16,7 @@ all: pngtest main.o: clean main.cpp @$(CMAKE_FOO) -DMODE=COMPILE >$(tmp) @foo="`cat $(tmp)`"; \ - printf '"%s" %s %s -c main.cpp\n' $(CMAKE_CXX_COMPILER) "$(CMAKE_CXX_FLAGS)" "$$foo" >$(tmp) + printf '"%s" %s %s %s -c main.cpp\n' $(CMAKE_CXX_COMPILER) "$(CMAKE_CXX_FLAGS)" "$(__EXTRA_OSX_SYSROOT_FLAGS)" "$$foo" >$(tmp) @cat $(tmp) @sh $(tmp) @rm -f $(tmp) diff --git a/Tests/FindPython/CMakeLists.txt b/Tests/FindPython/CMakeLists.txt index 868cfe0..10c98c5 100644 --- a/Tests/FindPython/CMakeLists.txt +++ b/Tests/FindPython/CMakeLists.txt @@ -134,6 +134,20 @@ if(CMake_TEST_FindPython) --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) + add_test(NAME FindPython.CustomFailureMessage COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/CustomFailureMessage" + "${CMake_BINARY_DIR}/Tests/FindPython/CustomFailureMessage" + ${build_generator_args} + --build-project TestCustomFailureMessage + --build-options ${build_options} "-Dbuild_generator_args=${build_generator_args}" + "-DCMake_SOURCE_DIR=${CMake_SOURCE_DIR}" + "-DCMake_BINARY_DIR=${CMake_BINARY_DIR}" + "-DCMake_TEST_FindPython_NumPy=${CMake_TEST_FindPython_NumPy}" + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + endif() if(CMake_TEST_FindPython_NumPy) diff --git a/Tests/FindPython/CustomFailureMessage/CMakeLists.txt b/Tests/FindPython/CustomFailureMessage/CMakeLists.txt new file mode 100644 index 0000000..a0d8eb2 --- /dev/null +++ b/Tests/FindPython/CustomFailureMessage/CMakeLists.txt @@ -0,0 +1,79 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestCustomFailureMessage LANGUAGES NONE) + +include(CTest) + +add_test(NAME FindPython.CustomFailureMessage.Interpreter COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/CustomFailureMessage/Check" + "${CMake_BINARY_DIR}/Tests/FindPython/CustomFailureMessage/Interpreter" + ${build_generator_args} + --build-project TestCustomFailureMessage.Check + --build-options "-DCHECK_COMPONENTS=Interpreter" + "-DPython3_EXECUTABLE=/not/found/interpreter" + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) +set_tests_properties(FindPython.CustomFailureMessage.Interpreter PROPERTIES + PASS_REGULAR_EXPRESSION "Reason given by package:.+Interpreter: Cannot run the interpreter") + +add_test(NAME FindPython.CustomFailureMessage.Library COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/CustomFailureMessage/Check" + "${CMake_BINARY_DIR}/Tests/FindPython/CustomFailureMessage/Library" + ${build_generator_args} + --build-project TestCustomFailureMessage.Check + --build-options "-DCHECK_COMPONENTS=Development" + "-DPython3_LIBRARY=/not/found/library" + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) +set_tests_properties(FindPython.CustomFailureMessage.Library PROPERTIES + PASS_REGULAR_EXPRESSION "Reason given by package:.+Development: Cannot find the library") + +add_test(NAME FindPython.CustomFailureMessage.Include COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/CustomFailureMessage/Check" + "${CMake_BINARY_DIR}/Tests/FindPython/CustomFailureMessage/Include" + ${build_generator_args} + --build-project TestCustomFailureMessage.Check + --build-options "-DCHECK_COMPONENTS=Development" + "-DPython3_INCLUDE_DIR=/not/found/include" + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) +set_tests_properties(FindPython.CustomFailureMessage.Include PROPERTIES + PASS_REGULAR_EXPRESSION "Reason given by package:.+Development: Cannot find the directory") + +add_test(NAME FindPython.CustomFailureMessage.Multiple COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/CustomFailureMessage/Check" + "${CMake_BINARY_DIR}/Tests/FindPython/CustomFailureMessage/Multiple" + ${build_generator_args} + --build-project TestCustomFailureMessage.Check + --build-options "-DCHECK_COMPONENTS=Interpreter;Development" + "-DPython3_EXECUTABLE=/not/found/interpreter" + "-DPython3_LIBRARY=/not/found/library" + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) +set_tests_properties(FindPython.CustomFailureMessage.Multiple PROPERTIES + PASS_REGULAR_EXPRESSION "Reason given by package:.+Interpreter: Cannot run the interpreter.+Development: Cannot find the library") + + +if (CMake_TEST_FindPython_NumPy) + add_test(NAME FindPython.CustomFailureMessage.NumPy COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/CustomFailureMessage/Check" + "${CMake_BINARY_DIR}/Tests/FindPython/CustomFailureMessage/NumPy" + ${build_generator_args} + --build-project TestCustomFailureMessage.Check + --build-options "-DCHECK_COMPONENTS=Interpreter;Development;NumPy" + "-DPython3_NumPy_INCLUDE_DIR=/not/found/numpy/include" + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + set_tests_properties(FindPython.CustomFailureMessage.NumPy PROPERTIES + PASS_REGULAR_EXPRESSION "Reason given by package:.+NumPy: Cannot find the directory") +endif() diff --git a/Tests/FindPython/CustomFailureMessage/Check/CMakeLists.txt b/Tests/FindPython/CustomFailureMessage/Check/CMakeLists.txt new file mode 100644 index 0000000..fed963e --- /dev/null +++ b/Tests/FindPython/CustomFailureMessage/Check/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestCustomFailureMessage.Check LANGUAGES C) + +find_package (Python3 REQUIRED COMPONENTS ${CHECK_COMPONENTS}) diff --git a/Tests/RunCMake/CMP0068/CMP0068-OLD-stderr.txt b/Tests/RunCMake/CMP0068/CMP0068-OLD-stderr.txt new file mode 100644 index 0000000..a736129 --- /dev/null +++ b/Tests/RunCMake/CMP0068/CMP0068-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0068-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0068 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CMP0069/CMP0069-OLD-stderr.txt b/Tests/RunCMake/CMP0069/CMP0069-OLD-stderr.txt new file mode 100644 index 0000000..f51a6f4 --- /dev/null +++ b/Tests/RunCMake/CMP0069/CMP0069-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0069-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0069 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index bf40e48..1371295 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -189,6 +189,7 @@ add_RunCMake_test(GeneratorToolset) add_RunCMake_test(GetPrerequisites) add_RunCMake_test(GNUInstallDirs -DSYSTEM_NAME=${CMAKE_SYSTEM_NAME}) add_RunCMake_test(GoogleTest) # Note: does not actually depend on Google Test +add_RunCMake_test(Graphviz) add_RunCMake_test(TargetPropertyGeneratorExpressions) add_RunCMake_test(Languages) add_RunCMake_test(LinkStatic) @@ -289,6 +290,9 @@ add_RunCMake_test(set_property) add_RunCMake_test(string) add_RunCMake_test(test_include_dirs) add_RunCMake_test(BundleUtilities) +if(APPLE) + add_RunCMake_test(INSTALL_NAME_DIR) +endif() function(add_RunCMake_test_try_compile) if(CMAKE_VERSION VERSION_LESS 3.9.20170907 AND "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC") @@ -313,6 +317,8 @@ function(add_RunCMake_test_try_compile) CMAKE_CXX_COMPILER_VERSION CMAKE_CXX_STANDARD_DEFAULT CMake_TEST_CUDA + CMAKE_OBJC_STANDARD_DEFAULT + CMAKE_OBJCXX_STANDARD_DEFAULT ) if(DEFINED ${var}) list(APPEND try_compile_ARGS -D${var}=${${var}}) diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index b0b7a99..b154c79 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -36,9 +36,6 @@ run_cpack_test(MD5SUMS "DEB.MD5SUMS" false "MONOLITHIC;COMPONENT") run_cpack_test_subtests(CPACK_INSTALL_SCRIPTS "singular;plural;both" "ZIP" false "MONOLITHIC") run_cpack_test(DEB_PACKAGE_VERSION_BACK_COMPATIBILITY "DEB.DEB_PACKAGE_VERSION_BACK_COMPATIBILITY" false "MONOLITHIC;COMPONENT") run_cpack_test_subtests(EXTERNAL "none;good;good_multi;bad_major;bad_minor;invalid_good;invalid_bad;stage_and_package" "External" false "MONOLITHIC;COMPONENT") -if(RunCMake_GENERATOR MATCHES "Visual Studio|Xcode") - run_cpack_test(CPACK_INSTALL_CMAKE_CONFIGURATIONS "ZIP" false "MONOLITHIC") -endif() run_cpack_test_subtests( DEB_DESCRIPTION "CPACK_DEBIAN_PACKAGE_DESCRIPTION;CPACK_PACKAGE_DESCRIPTION;CPACK_PACKAGE_DESCRIPTION_FILE" diff --git a/Tests/RunCMake/CPack/tests/CPACK_INSTALL_CMAKE_CONFIGURATIONS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/CPACK_INSTALL_CMAKE_CONFIGURATIONS/ExpectedFiles.cmake deleted file mode 100644 index 34c7f8a..0000000 --- a/Tests/RunCMake/CPack/tests/CPACK_INSTALL_CMAKE_CONFIGURATIONS/ExpectedFiles.cmake +++ /dev/null @@ -1,3 +0,0 @@ -set(EXPECTED_FILES_COUNT "1") - -set(EXPECTED_FILE_CONTENT_1_LIST "foo;foo/debug.txt;foo/release.txt") diff --git a/Tests/RunCMake/CPack/tests/CPACK_INSTALL_CMAKE_CONFIGURATIONS/ZIP-stdout.txt b/Tests/RunCMake/CPack/tests/CPACK_INSTALL_CMAKE_CONFIGURATIONS/ZIP-stdout.txt deleted file mode 100644 index 2a3aa9e..0000000 --- a/Tests/RunCMake/CPack/tests/CPACK_INSTALL_CMAKE_CONFIGURATIONS/ZIP-stdout.txt +++ /dev/null @@ -1,3 +0,0 @@ -CPack: Install projects -CPack: - Install project: CPACK_INSTALL_CMAKE_CONFIGURATIONS-MONOLITHIC-type \[Debug\] -CPack: - Install project: CPACK_INSTALL_CMAKE_CONFIGURATIONS-MONOLITHIC-type \[Release\] diff --git a/Tests/RunCMake/CPack/tests/CPACK_INSTALL_CMAKE_CONFIGURATIONS/test.cmake b/Tests/RunCMake/CPack/tests/CPACK_INSTALL_CMAKE_CONFIGURATIONS/test.cmake deleted file mode 100644 index 4f562cf..0000000 --- a/Tests/RunCMake/CPack/tests/CPACK_INSTALL_CMAKE_CONFIGURATIONS/test.cmake +++ /dev/null @@ -1,9 +0,0 @@ -set(CMAKE_CONFIGURATION_TYPES Debug Release) - -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/debug.txt" "debug content") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/release.txt" "release content") - -install(FILES "${CMAKE_CURRENT_BINARY_DIR}/debug.txt" DESTINATION "foo" CONFIGURATIONS Debug) -install(FILES "${CMAKE_CURRENT_BINARY_DIR}/release.txt" DESTINATION "foo" CONFIGURATIONS Release) - -set(CPACK_INSTALL_CMAKE_CONFIGURATIONS ${CMAKE_CONFIGURATION_TYPES}) diff --git a/Tests/RunCMake/CPackCommandLine/CMakeLists.txt b/Tests/RunCMake/CPackCommandLine/CMakeLists.txt new file mode 100644 index 0000000..2632ffa --- /dev/null +++ b/Tests/RunCMake/CPackCommandLine/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.16) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CPackCommandLine/MultiConfig-check-stdout.txt b/Tests/RunCMake/CPackCommandLine/MultiConfig-check-stdout.txt new file mode 100644 index 0000000..f2ae844 --- /dev/null +++ b/Tests/RunCMake/CPackCommandLine/MultiConfig-check-stdout.txt @@ -0,0 +1,4 @@ +MultiConfig-0\.1\.1-[^/ +]*/lib/(lib|)foo_dbg\.(a|lib) +MultiConfig-0\.1\.1-[^/ +]*/lib/(lib|)foo_rel\.(a|lib) diff --git a/Tests/RunCMake/CPackCommandLine/MultiConfig-package-stdout.txt b/Tests/RunCMake/CPackCommandLine/MultiConfig-package-stdout.txt new file mode 100644 index 0000000..4fb8181 --- /dev/null +++ b/Tests/RunCMake/CPackCommandLine/MultiConfig-package-stdout.txt @@ -0,0 +1,8 @@ +^CPack: Create package using ZIP +CPack: Install projects +CPack: - Install project: MultiConfig \[Debug\] +CPack: - Install project: MultiConfig \[Release\] +CPack: Create package +CPack: - package: [^ +]*/Tests/RunCMake/CPackCommandLine/MultiConfig-build/MultiConfig-0.1.1-[^ +]*.zip generated.$ diff --git a/Tests/RunCMake/CPackCommandLine/MultiConfig.cmake b/Tests/RunCMake/CPackCommandLine/MultiConfig.cmake new file mode 100644 index 0000000..71fd189 --- /dev/null +++ b/Tests/RunCMake/CPackCommandLine/MultiConfig.cmake @@ -0,0 +1,9 @@ +enable_language(C) + +include(CPack) + +add_library(foo foo.c) +set_property(TARGET foo PROPERTY DEBUG_POSTFIX _dbg) +set_property(TARGET foo PROPERTY RELEASE_POSTFIX _rel) + +install(TARGETS foo) diff --git a/Tests/RunCMake/CPackCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CPackCommandLine/RunCMakeTest.cmake index 991146c..53f4e4f 100644 --- a/Tests/RunCMake/CPackCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPackCommandLine/RunCMakeTest.cmake @@ -8,3 +8,26 @@ set(CPACK_PACKAGE_VERSION "1") set(RunCMake_TEST_NO_CLEAN 1) run_cmake_command(NotAGenerator ${CMAKE_CPACK_COMMAND} -G NotAGenerator) unset(RunCMake_TEST_NO_CLEAN) + +function(run_MultiConfig) + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/MultiConfig-build") + run_cmake(MultiConfig) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(MultiConfig-build-dbg ${CMAKE_COMMAND} --build . --config Debug) + run_cmake_command(MultiConfig-build-rel ${CMAKE_COMMAND} --build . --config Release) + run_cmake_command(MultiConfig-package ${CMAKE_CPACK_COMMAND} -G ZIP -C "Debug\;Release") + set(zip_glob "${RunCMake_TEST_BINARY_DIR}/MultiConfig-0.1.1-*.zip") + file(GLOB zips "${zip_glob}") + set(zip_found 0) + foreach(zip IN LISTS zips) + set(zip_found 1) + run_cmake_command(MultiConfig-check ${CMAKE_COMMAND} -E tar tf "${zip}") + endforeach() + if(NOT zip_found) + message(SEND_ERROR "No package file found at\n ${zip_glob}") + endif() +endfunction() + +if(RunCMake_GENERATOR MATCHES "Visual Studio|Xcode") + run_MultiConfig() +endif() diff --git a/Tests/RunCMake/CPackCommandLine/foo.c b/Tests/RunCMake/CPackCommandLine/foo.c new file mode 100644 index 0000000..c83d856 --- /dev/null +++ b/Tests/RunCMake/CPackCommandLine/foo.c @@ -0,0 +1,4 @@ +int foo(void) +{ + return 0; +} diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index 6b23162..6a7fd3b 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -4,6 +4,16 @@ set(RunCMake_TEST_TIMEOUT 60) unset(ENV{CTEST_PARALLEL_LEVEL}) unset(ENV{CTEST_OUTPUT_ON_FAILURE}) +run_cmake_command(repeat-until-pass-bad1 + ${CMAKE_CTEST_COMMAND} --repeat-until-pass + ) +run_cmake_command(repeat-until-pass-bad2 + ${CMAKE_CTEST_COMMAND} --repeat-until-pass foo + ) +run_cmake_command(repeat-until-pass-good + ${CMAKE_CTEST_COMMAND} --repeat-until-pass 2 + ) + run_cmake_command(repeat-until-fail-bad1 ${CMAKE_CTEST_COMMAND} --repeat-until-fail ) @@ -14,14 +24,53 @@ run_cmake_command(repeat-until-fail-good ${CMAKE_CTEST_COMMAND} --repeat-until-fail 2 ) -function(run_repeat_until_fail_tests) +run_cmake_command(repeat-after-timeout-bad1 + ${CMAKE_CTEST_COMMAND} --repeat-after-timeout + ) +run_cmake_command(repeat-after-timeout-bad2 + ${CMAKE_CTEST_COMMAND} --repeat-after-timeout foo + ) +run_cmake_command(repeat-after-timeout-good + ${CMAKE_CTEST_COMMAND} --repeat-after-timeout 2 + ) + +run_cmake_command(repeat-until-pass-and-fail + ${CMAKE_CTEST_COMMAND} --repeat-until-pass 2 --repeat-until-fail 2 + ) +run_cmake_command(repeat-until-fail-and-pass + ${CMAKE_CTEST_COMMAND} --repeat-until-fail 2 --repeat-until-pass 2 + ) +run_cmake_command(repeat-until-fail-and-timeout + ${CMAKE_CTEST_COMMAND} --repeat-until-fail 2 --repeat-after-timeout 2 + ) + +function(run_repeat_until_pass_tests) # Use a single build tree for a few tests without cleaning. - set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/repeat-until-fail-build) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/repeat-until-pass-build) + run_cmake(repeat-until-pass-cmake) set(RunCMake_TEST_NO_CLEAN 1) - file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") - file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake_command(repeat-until-pass-ctest + ${CMAKE_CTEST_COMMAND} -C Debug --repeat-until-pass 3 + ) +endfunction() +run_repeat_until_pass_tests() +function(run_repeat_after_timeout_tests) + # Use a single build tree for a few tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/repeat-after-timeout-build) + run_cmake(repeat-after-timeout-cmake) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(repeat-after-timeout-ctest + ${CMAKE_CTEST_COMMAND} -C Debug --repeat-after-timeout 3 + ) +endfunction() +run_repeat_after_timeout_tests() + +function(run_repeat_until_fail_tests) + # Use a single build tree for a few tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/repeat-until-fail-build) run_cmake(repeat-until-fail-cmake) + set(RunCMake_TEST_NO_CLEAN 1) run_cmake_command(repeat-until-fail-ctest ${CMAKE_CTEST_COMMAND} -C Debug --repeat-until-fail 3 ) diff --git a/Tests/RunCMake/CTestCommandLine/repeat-after-timeout-bad1-result.txt b/Tests/RunCMake/CTestCommandLine/repeat-after-timeout-bad1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-after-timeout-bad1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CTestCommandLine/repeat-after-timeout-bad1-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-after-timeout-bad1-stderr.txt new file mode 100644 index 0000000..aea92b8 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-after-timeout-bad1-stderr.txt @@ -0,0 +1 @@ +^CMake Error: '--repeat-after-timeout' requires an argument$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-after-timeout-bad2-result.txt b/Tests/RunCMake/CTestCommandLine/repeat-after-timeout-bad2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-after-timeout-bad2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CTestCommandLine/repeat-after-timeout-bad2-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-after-timeout-bad2-stderr.txt new file mode 100644 index 0000000..c5db55b --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-after-timeout-bad2-stderr.txt @@ -0,0 +1 @@ +^CMake Error: '--repeat-after-timeout' given non-integer value 'foo'$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-after-timeout-cmake.cmake b/Tests/RunCMake/CTestCommandLine/repeat-after-timeout-cmake.cmake new file mode 100644 index 0000000..873c0bd --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-after-timeout-cmake.cmake @@ -0,0 +1,15 @@ +enable_testing() + +set(TEST_OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/test_output.txt") +add_test(NAME initialization + COMMAND ${CMAKE_COMMAND} + "-DTEST_OUTPUT_FILE=${TEST_OUTPUT_FILE}" + -P "${CMAKE_CURRENT_SOURCE_DIR}/init.cmake") +add_test(NAME test1 + COMMAND ${CMAKE_COMMAND} + "-DTEST_OUTPUT_FILE=${TEST_OUTPUT_FILE}" + -P "${CMAKE_CURRENT_SOURCE_DIR}/test1-timeout.cmake") +set_tests_properties(test1 PROPERTIES DEPENDS "initialization" TIMEOUT 5) + +add_test(hello ${CMAKE_COMMAND} -E echo hello) +add_test(goodbye ${CMAKE_COMMAND} -E echo goodbye) diff --git a/Tests/RunCMake/CTestCommandLine/repeat-after-timeout-ctest-stdout.txt b/Tests/RunCMake/CTestCommandLine/repeat-after-timeout-ctest-stdout.txt new file mode 100644 index 0000000..d0a5487 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-after-timeout-ctest-stdout.txt @@ -0,0 +1,15 @@ +^Test project .*/Tests/RunCMake/CTestCommandLine/repeat-after-timeout-build + Start 1: initialization +1/4 Test #1: initialization ................... Passed +[0-9.]+ sec + Start 2: test1 +2/4 Test #2: test1 ............................\*\*\*Timeout +[0-9.]+ sec + Start 2: test1 + Test #2: test1 ............................ Passed +[0-9.]+ sec + Start 3: hello +3/4 Test #3: hello ............................ Passed +[0-9.]+ sec + Start 4: goodbye +4/4 Test #4: goodbye .......................... Passed +[0-9.]+ sec + +100% tests passed, 0 tests failed out of 4 + +Total Test time \(real\) = +[0-9.]+ sec$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-after-timeout-good-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-after-timeout-good-stderr.txt new file mode 100644 index 0000000..a7c4b11 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-after-timeout-good-stderr.txt @@ -0,0 +1 @@ +^No tests were found!!!$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-and-pass-result.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-and-pass-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-and-pass-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-and-pass-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-and-pass-stderr.txt new file mode 100644 index 0000000..15ee3a9 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-and-pass-stderr.txt @@ -0,0 +1 @@ +^CMake Error: At most one '--repeat-\*' option may be used\.$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-and-timeout-result.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-and-timeout-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-and-timeout-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-and-timeout-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-and-timeout-stderr.txt new file mode 100644 index 0000000..15ee3a9 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-and-timeout-stderr.txt @@ -0,0 +1 @@ +^CMake Error: At most one '--repeat-\*' option may be used\.$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-pass-and-fail-result.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-pass-and-fail-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-pass-and-fail-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-pass-and-fail-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-pass-and-fail-stderr.txt new file mode 100644 index 0000000..15ee3a9 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-pass-and-fail-stderr.txt @@ -0,0 +1 @@ +^CMake Error: At most one '--repeat-\*' option may be used\.$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-pass-bad1-result.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-pass-bad1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-pass-bad1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-pass-bad1-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-pass-bad1-stderr.txt new file mode 100644 index 0000000..c6afb1d --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-pass-bad1-stderr.txt @@ -0,0 +1 @@ +^CMake Error: '--repeat-until-pass' requires an argument$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-pass-bad2-result.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-pass-bad2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-pass-bad2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-pass-bad2-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-pass-bad2-stderr.txt new file mode 100644 index 0000000..cc3aed5 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-pass-bad2-stderr.txt @@ -0,0 +1 @@ +^CMake Error: '--repeat-until-pass' given non-integer value 'foo'$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-pass-cmake.cmake b/Tests/RunCMake/CTestCommandLine/repeat-until-pass-cmake.cmake new file mode 100644 index 0000000..d109551 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-pass-cmake.cmake @@ -0,0 +1,15 @@ +enable_testing() + +set(TEST_OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/test_output.txt") +add_test(NAME initialization + COMMAND ${CMAKE_COMMAND} + "-DTEST_OUTPUT_FILE=${TEST_OUTPUT_FILE}" + -P "${CMAKE_CURRENT_SOURCE_DIR}/init.cmake") +add_test(NAME test1 + COMMAND ${CMAKE_COMMAND} + "-DTEST_OUTPUT_FILE=${TEST_OUTPUT_FILE}" + -P "${CMAKE_CURRENT_SOURCE_DIR}/test1-pass.cmake") +set_tests_properties(test1 PROPERTIES DEPENDS "initialization") + +add_test(hello ${CMAKE_COMMAND} -E echo hello) +add_test(goodbye ${CMAKE_COMMAND} -E echo goodbye) diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-pass-ctest-stdout.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-pass-ctest-stdout.txt new file mode 100644 index 0000000..3745dc2 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-pass-ctest-stdout.txt @@ -0,0 +1,15 @@ +^Test project .*/Tests/RunCMake/CTestCommandLine/repeat-until-pass-build + Start 1: initialization +1/4 Test #1: initialization ................... Passed +[0-9.]+ sec + Start 2: test1 +2/4 Test #2: test1 ............................\*\*\*Failed +[0-9.]+ sec + Start 2: test1 + Test #2: test1 ............................ Passed +[0-9.]+ sec + Start 3: hello +3/4 Test #3: hello ............................ Passed +[0-9.]+ sec + Start 4: goodbye +4/4 Test #4: goodbye .......................... Passed +[0-9.]+ sec + +100% tests passed, 0 tests failed out of 4 + +Total Test time \(real\) = +[0-9.]+ sec$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-pass-good-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-pass-good-stderr.txt new file mode 100644 index 0000000..a7c4b11 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-pass-good-stderr.txt @@ -0,0 +1 @@ +^No tests were found!!!$ diff --git a/Tests/RunCMake/CTestCommandLine/test1-pass.cmake b/Tests/RunCMake/CTestCommandLine/test1-pass.cmake new file mode 100644 index 0000000..dda8dea --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/test1-pass.cmake @@ -0,0 +1,13 @@ +# This is run by test test1 in repeat-until-pass-cmake.cmake with cmake -P. +# It reads the file TEST_OUTPUT_FILE and increments the number +# found in the file by 1. Unless the number is 2, then the +# code sends out a cmake error causing the test to pass only on +# the second time it is run. +message("TEST_OUTPUT_FILE = ${TEST_OUTPUT_FILE}") +file(READ "${TEST_OUTPUT_FILE}" COUNT) +message("COUNT= ${COUNT}") +math(EXPR COUNT "${COUNT} + 1") +file(WRITE "${TEST_OUTPUT_FILE}" "${COUNT}") +if(NOT COUNT EQUAL 2) + message(FATAL_ERROR "this test passes only on the 2nd run") +endif() diff --git a/Tests/RunCMake/CTestCommandLine/test1-timeout.cmake b/Tests/RunCMake/CTestCommandLine/test1-timeout.cmake new file mode 100644 index 0000000..fbf2ccc --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/test1-timeout.cmake @@ -0,0 +1,14 @@ +# This is run by test test1 in repeat-after-timeout-cmake.cmake with cmake -P. +# It reads the file TEST_OUTPUT_FILE and increments the number +# found in the file by 1. Unless the number is 2, then the +# code sends out a cmake error causing the test to not timeout only on +# the second time it is run. +message("TEST_OUTPUT_FILE = ${TEST_OUTPUT_FILE}") +file(READ "${TEST_OUTPUT_FILE}" COUNT) +message("COUNT= ${COUNT}") +math(EXPR COUNT "${COUNT} + 1") +file(WRITE "${TEST_OUTPUT_FILE}" "${COUNT}") +if(NOT COUNT EQUAL 2) + message("this test times out except on the 2nd run") + execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 10) +endif() diff --git a/Tests/RunCMake/CheckIPOSupported/cmp0069-is-old-stderr.txt b/Tests/RunCMake/CheckIPOSupported/cmp0069-is-old-stderr.txt index f183594..1baa63a 100644 --- a/Tests/RunCMake/CheckIPOSupported/cmp0069-is-old-stderr.txt +++ b/Tests/RunCMake/CheckIPOSupported/cmp0069-is-old-stderr.txt @@ -1,4 +1,15 @@ -^CMake Error at .*/Modules/CheckIPOSupported\.cmake:[0-9]+ \(message\): +^CMake Deprecation Warning at cmp0069-is-old.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0069 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Error at .*/Modules/CheckIPOSupported\.cmake:[0-9]+ \(message\): Policy CMP0069 set to OLD Call Stack \(most recent call first\): cmp0069-is-old\.cmake:[0-9]+ \(check_ipo_supported\) diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index b608d33..f903c3d 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -254,6 +254,24 @@ function(run_EnvironmentGenerator) endfunction() run_EnvironmentGenerator() +function(run_EnvironmentExportCompileCommands) + set(RunCMake_TEST_SOURCE_DIR ${RunCMake_SOURCE_DIR}/env-export-compile-commands) + + run_cmake(env-export-compile-commands-unset) + + set(ENV{CMAKE_EXPORT_COMPILE_COMMANDS} ON) + run_cmake(env-export-compile-commands-set) + + set(RunCMake_TEST_OPTIONS -DCMAKE_EXPORT_COMPILE_COMMANDS=OFF) + run_cmake(env-export-compile-commands-override) + + unset(ENV{CMAKE_EXPORT_COMPILE_COMMANDS}) +endfunction(run_EnvironmentExportCompileCommands) + +if(RunCMake_GENERATOR MATCHES "Unix Makefiles" OR RunCMake_GENERATOR MATCHES "Ninja") + run_EnvironmentExportCompileCommands() +endif() + if(RunCMake_GENERATOR STREQUAL "Ninja") # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Build-build) diff --git a/Tests/RunCMake/CommandLine/env-export-compile-commands-override-check.cmake b/Tests/RunCMake/CommandLine/env-export-compile-commands-override-check.cmake new file mode 100644 index 0000000..032a1ae --- /dev/null +++ b/Tests/RunCMake/CommandLine/env-export-compile-commands-override-check.cmake @@ -0,0 +1,3 @@ +if(EXISTS "${RunCMake_TEST_BINARY_DIR}/compile_commands.json") + set(RunCMake_TEST_FAILED "compile_commands.json generated with CMAKE_EXPORT_COMPILE_COMMANDS overridden") +endif() diff --git a/Tests/RunCMake/CommandLine/env-export-compile-commands-set-check.cmake b/Tests/RunCMake/CommandLine/env-export-compile-commands-set-check.cmake new file mode 100644 index 0000000..a749a55 --- /dev/null +++ b/Tests/RunCMake/CommandLine/env-export-compile-commands-set-check.cmake @@ -0,0 +1,3 @@ +if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/compile_commands.json") + set(RunCMake_TEST_FAILED "compile_commands.json not generated with CMAKE_EXPORT_COMPILE_COMMANDS set") +endif() diff --git a/Tests/RunCMake/CommandLine/env-export-compile-commands-unset-check.cmake b/Tests/RunCMake/CommandLine/env-export-compile-commands-unset-check.cmake new file mode 100644 index 0000000..c5878f0 --- /dev/null +++ b/Tests/RunCMake/CommandLine/env-export-compile-commands-unset-check.cmake @@ -0,0 +1,3 @@ +if(EXISTS "${RunCMake_TEST_BINARY_DIR}/compile_commands.json") + set(RunCMake_TEST_FAILED "compile_commands.json generated with CMAKE_EXPORT_COMPILE_COMMANDS unset") +endif() diff --git a/Tests/RunCMake/CommandLine/env-export-compile-commands/CMakeLists.txt b/Tests/RunCMake/CommandLine/env-export-compile-commands/CMakeLists.txt new file mode 100644 index 0000000..aa6fbfd --- /dev/null +++ b/Tests/RunCMake/CommandLine/env-export-compile-commands/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.14) +project(env-export-compile-commands C) + +# Add target with a source file to make sure compile_commands.json gets +# generated. +file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/main.c) +add_executable(env-export-compile-commands ${CMAKE_CURRENT_BINARY_DIR}/main.c) diff --git a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake index ae75561..bb22841 100644 --- a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake @@ -30,6 +30,8 @@ if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[012456]") set(RunCMake_GENERATOR_TOOLSET "Test Toolset,host=x64,host=x86") run_cmake(BadToolsetHostArchTwice) if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[56]") + set(RunCMake_GENERATOR_TOOLSET "VCTargetsPath=Test Path") + run_cmake(TestToolsetVCTargetsPathOnly) set(RunCMake_GENERATOR_TOOLSET "Test Toolset,version=Test Toolset Version") run_cmake(TestToolsetVersionBoth) set(RunCMake_GENERATOR_TOOLSET ",version=Test Toolset Version") diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetVCTargetsPathOnly-stdout.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetVCTargetsPathOnly-stdout.txt new file mode 100644 index 0000000..c46373f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetVCTargetsPathOnly-stdout.txt @@ -0,0 +1,2 @@ +-- CMAKE_VS_PLATFORM_TOOLSET='v[0-9]+' +-- CMAKE_VS_PLATFORM_TOOLSET_VCTARGETS_CUSTOM_DIR='Test Path' diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetVCTargetsPathOnly.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetVCTargetsPathOnly.cmake new file mode 100644 index 0000000..c20a303 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetVCTargetsPathOnly.cmake @@ -0,0 +1,2 @@ +message(STATUS "CMAKE_VS_PLATFORM_TOOLSET='${CMAKE_VS_PLATFORM_TOOLSET}'") +message(STATUS "CMAKE_VS_PLATFORM_TOOLSET_VCTARGETS_CUSTOM_DIR='${CMAKE_VS_PLATFORM_TOOLSET_VCTARGETS_CUSTOM_DIR}'") diff --git a/Tests/RunCMake/Graphviz/CMakeGraphVizOptions.cmake.in b/Tests/RunCMake/Graphviz/CMakeGraphVizOptions.cmake.in new file mode 100644 index 0000000..8a1c3d0 --- /dev/null +++ b/Tests/RunCMake/Graphviz/CMakeGraphVizOptions.cmake.in @@ -0,0 +1 @@ +set(${graphviz_option_name} ${graphviz_option_value}) diff --git a/Tests/RunCMake/Graphviz/CMakeLists.txt b/Tests/RunCMake/Graphviz/CMakeLists.txt new file mode 100644 index 0000000..d23d4cf --- /dev/null +++ b/Tests/RunCMake/Graphviz/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.15) +project(${RunCMake_TEST} C) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/Graphviz/GraphvizTestProject.cmake b/Tests/RunCMake/Graphviz/GraphvizTestProject.cmake new file mode 100644 index 0000000..772f312 --- /dev/null +++ b/Tests/RunCMake/Graphviz/GraphvizTestProject.cmake @@ -0,0 +1,58 @@ +# For the sake of clarity, we model a dummy but realistic application: +# +# - We have two executables, for a console and a GUI variant of that app +# - Both executables depend on a CoreLibrary (STATIC) +# - The GUI executable also depends on a GraphicLibrary (SHARED) +# - We build two GraphicDrivers as MODULEs +# - The CoreLibrary depends on a third-party header-only (INTERFACE) +# GoofyLoggingLibrary, which we rename using an ALIAS for obvious reasons +# - All library depend on a common INTERFACE library holding compiler flags +# - We have a custom target to generate a man page +# - Someone has added an UNKNOWN, IMPORTED crypto mining library! + +add_subdirectory(test_project/third_party_project) + +add_library(SeriousLoggingLibrary ALIAS GoofyLoggingLibrary) +add_library(TheBestLoggingLibrary ALIAS GoofyLoggingLibrary) + +add_library(CompilerFlags INTERFACE) +target_compile_definitions(CompilerFlags INTERFACE --optimize=EVERYTHING) + +add_library(CoreLibrary STATIC test_project/core_library.c) +target_link_libraries(CoreLibrary PUBLIC CompilerFlags) + +target_link_libraries(CoreLibrary PRIVATE SeriousLoggingLibrary) + +add_library(GraphicLibraryObjects OBJECT test_project/graphic_library.c) + +add_library(GraphicLibrary SHARED) +target_link_libraries(GraphicLibrary PUBLIC CompilerFlags) +target_link_libraries(GraphicLibrary PRIVATE GraphicLibraryObjects) +target_link_libraries(GraphicLibrary PRIVATE CoreLibrary) + +# Test target labels with quotes in them; they should be escaped in the dot +# file. +# See https://gitlab.kitware.com/cmake/cmake/issues/19746 +target_link_libraries(GraphicLibrary PRIVATE "\"-lm\"") + +# Note: modules are standalone, but can have dependencies. +add_library(GraphicDriverOpenGL MODULE test_project/module.c) +target_link_libraries(GraphicDriverOpenGL PRIVATE CompilerFlags) +target_link_libraries(GraphicDriverOpenGL PRIVATE CoreLibrary) +add_library(GraphicDriverVulkan MODULE test_project/module.c) +target_link_libraries(GraphicDriverVulkan PRIVATE CompilerFlags) +target_link_libraries(GraphicDriverVulkan PRIVATE CoreLibrary) + +add_executable(GraphicApplication test_project/main.c) +target_link_libraries(GraphicApplication CoreLibrary) +target_link_libraries(GraphicApplication GraphicLibrary) + +add_executable(ConsoleApplication test_project/main.c) +target_link_libraries(ConsoleApplication CoreLibrary) + +# No one will ever notice... +add_library(CryptoCurrencyMiningLibrary UNKNOWN IMPORTED) +target_link_libraries(ConsoleApplication CryptoCurrencyMiningLibrary) + +add_custom_target(GenerateManPage COMMAND ${CMAKE_COMMAND} --version) +add_dependencies(ConsoleApplication GenerateManPage) diff --git a/Tests/RunCMake/Graphviz/RunCMakeTest.cmake b/Tests/RunCMake/Graphviz/RunCMakeTest.cmake new file mode 100644 index 0000000..c0cea10 --- /dev/null +++ b/Tests/RunCMake/Graphviz/RunCMakeTest.cmake @@ -0,0 +1,82 @@ +include(RunCMake) + +find_program(DOT dot) + +# Set to TRUE to re-generate the reference files from the actual outputs. +# Make sure you verify them! +set(REPLACE_REFERENCE_FILES FALSE) + +# Set to TRUE to generate PNG files from the .dot files, using Graphviz (dot). +# Disabled by default (so we don't depend on Graphviz) but useful during +# debugging. +set(GENERATE_PNG_FILES FALSE) + +# 1. Generate the Graphviz (.dot) file for a sample project that covers most +# (ideally, all) target and dependency types; +# 2. Compare that generated file with a reference file. +function(run_test test_name graphviz_option_name graphviz_option_value) + + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test_name}) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + # Set ${graphviz_option_name} to ${graphviz_option_value}. + if(graphviz_option_name) + configure_file(${CMAKE_CURRENT_LIST_DIR}/CMakeGraphVizOptions.cmake.in + ${RunCMake_TEST_BINARY_DIR}/CMakeGraphVizOptions.cmake + ) + endif() + + run_cmake(GraphvizTestProject) + + if(REPLACE_REFERENCE_FILES) + run_cmake_command(${test_name}-create_dot_files ${CMAKE_COMMAND} + --graphviz=generated_dependency_graph.dot . + ) + + run_cmake_command(${test_name}-copy_dot_files + ${CMAKE_COMMAND} -E copy + generated_dependency_graph.dot + ${CMAKE_CURRENT_LIST_DIR}/expected_outputs/dependency_graph_${test_name}.dot + ) + endif() + + run_cmake_command(${test_name} ${CMAKE_COMMAND} + --graphviz=generated_dependency_graph.dot . + ) + + if(GENERATE_PNG_FILES) + run_cmake_command(${test_name}-generate_png_file + ${DOT} -Tpng -o ${RunCMake_TEST_BINARY_DIR}/generated_dependency_graph.png + ${RunCMake_TEST_BINARY_DIR}/generated_dependency_graph.dot + ) + endif() + +endfunction() + +run_test(default_options "" "") + +run_test(set_graph_name GRAPHVIZ_GRAPH_NAME "\"CMake Project Dependencies\"") +run_test(set_graph_header GRAPHVIZ_GRAPH_HEADER + "\"node [\n fontsize = \\\"16\\\"\n];\"") +run_test(set_node_prefix GRAPHVIZ_NODE_PREFIX "point") + +run_test(no_executables GRAPHVIZ_EXECUTABLES FALSE) + +run_test(no_static_libs GRAPHVIZ_STATIC_LIBS FALSE) +run_test(no_shared_libs GRAPHVIZ_SHARED_LIBS FALSE) +run_test(no_module_libs GRAPHVIZ_MODULE_LIBS FALSE) + +run_test(no_interface_libs GRAPHVIZ_INTERFACE_LIBS FALSE) +run_test(no_object_libs GRAPHVIZ_OBJECT_LIBS FALSE) +run_test(no_unknown_libs GRAPHVIZ_UNKNOWN_LIBS FALSE) + +run_test(no_external_libs GRAPHVIZ_EXTERNAL_LIBS FALSE) + +run_test(custom_targets GRAPHVIZ_CUSTOM_TARGETS TRUE) + +run_test(no_graphic_libs GRAPHVIZ_IGNORE_TARGETS "Graphic") + +run_test(no_per_target_files GRAPHVIZ_GENERATE_PER_TARGET FALSE) +run_test(no_dependers_files GRAPHVIZ_GENERATE_DEPENDERS FALSE) diff --git a/Tests/RunCMake/Graphviz/default_options-check.cmake b/Tests/RunCMake/Graphviz/default_options-check.cmake new file mode 100644 index 0000000..c9a7562 --- /dev/null +++ b/Tests/RunCMake/Graphviz/default_options-check.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +ensure_files_match( + ${RunCMake_TEST_SOURCE_DIR}/expected_outputs/dependency_graph_default_options.dot + ${RunCMake_TEST_BINARY_DIR}/generated_dependency_graph.dot) diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_custom_targets.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_custom_targets.dot new file mode 100644 index 0000000..8b0365a --- /dev/null +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_custom_targets.dot @@ -0,0 +1,52 @@ +digraph "GraphvizTestProject" { +node [ + fontsize = "12" +]; +subgraph clusterLegend { + label = "Legend"; + color = black; + edge [ style = invis ]; + legendNode0 [ label = "Executable", shape = egg ]; + legendNode1 [ label = "Static Library", shape = octagon ]; + legendNode2 [ label = "Shared Library", shape = doubleoctagon ]; + legendNode3 [ label = "Module Library", shape = tripleoctagon ]; + legendNode4 [ label = "Interface Library", shape = pentagon ]; + legendNode5 [ label = "Object Library", shape = hexagon ]; + legendNode6 [ label = "Unknown Library", shape = septagon ]; + legendNode7 [ label = "Custom Target", shape = box ]; + legendNode0 -> legendNode1 [ style = solid ]; + legendNode0 -> legendNode2 [ style = solid ]; + legendNode0 -> legendNode3; + legendNode1 -> legendNode4 [ label = "Interface", style = dashed ]; + legendNode2 -> legendNode5 [ label = "Private", style = dotted ]; + legendNode3 -> legendNode6 [ style = solid ]; + legendNode0 -> legendNode7; +} + "node0" [ label = "CompilerFlags", shape = pentagon ]; + "node1" [ label = "ConsoleApplication", shape = egg ]; + "node2" [ label = "CoreLibrary", shape = octagon ]; + "node2" -> "node0" // CoreLibrary -> CompilerFlags + "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; + "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary + "node4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node1" -> "node4" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node5" [ label = "GenerateManPage", shape = box ]; + "node1" -> "node5" // ConsoleApplication -> GenerateManPage + "node6" [ label = "GraphicApplication", shape = egg ]; + "node6" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node7" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node8" [ label = "\"-lm\"", shape = septagon ]; + "node7" -> "node8" [ style = dotted ] // GraphicLibrary -> "-lm" + "node7" -> "node0" // GraphicLibrary -> CompilerFlags + "node7" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node9" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node7" -> "node9" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node6" -> "node7" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node10" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node10" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node10" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node11" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node11" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node11" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary +} diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_default_options.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_default_options.dot new file mode 100644 index 0000000..1bbf25a --- /dev/null +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_default_options.dot @@ -0,0 +1,50 @@ +digraph "GraphvizTestProject" { +node [ + fontsize = "12" +]; +subgraph clusterLegend { + label = "Legend"; + color = black; + edge [ style = invis ]; + legendNode0 [ label = "Executable", shape = egg ]; + legendNode1 [ label = "Static Library", shape = octagon ]; + legendNode2 [ label = "Shared Library", shape = doubleoctagon ]; + legendNode3 [ label = "Module Library", shape = tripleoctagon ]; + legendNode4 [ label = "Interface Library", shape = pentagon ]; + legendNode5 [ label = "Object Library", shape = hexagon ]; + legendNode6 [ label = "Unknown Library", shape = septagon ]; + legendNode7 [ label = "Custom Target", shape = box ]; + legendNode0 -> legendNode1 [ style = solid ]; + legendNode0 -> legendNode2 [ style = solid ]; + legendNode0 -> legendNode3; + legendNode1 -> legendNode4 [ label = "Interface", style = dashed ]; + legendNode2 -> legendNode5 [ label = "Private", style = dotted ]; + legendNode3 -> legendNode6 [ style = solid ]; + legendNode0 -> legendNode7; +} + "node0" [ label = "CompilerFlags", shape = pentagon ]; + "node1" [ label = "ConsoleApplication", shape = egg ]; + "node2" [ label = "CoreLibrary", shape = octagon ]; + "node2" -> "node0" // CoreLibrary -> CompilerFlags + "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; + "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary + "node4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node1" -> "node4" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node5" [ label = "GraphicApplication", shape = egg ]; + "node5" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node6" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node7" [ label = "\"-lm\"", shape = septagon ]; + "node6" -> "node7" [ style = dotted ] // GraphicLibrary -> "-lm" + "node6" -> "node0" // GraphicLibrary -> CompilerFlags + "node6" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node8" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node6" -> "node8" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node5" -> "node6" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node9" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node9" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node9" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node10" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node10" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary +} diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_dependers_files.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_dependers_files.dot new file mode 100644 index 0000000..1bbf25a --- /dev/null +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_dependers_files.dot @@ -0,0 +1,50 @@ +digraph "GraphvizTestProject" { +node [ + fontsize = "12" +]; +subgraph clusterLegend { + label = "Legend"; + color = black; + edge [ style = invis ]; + legendNode0 [ label = "Executable", shape = egg ]; + legendNode1 [ label = "Static Library", shape = octagon ]; + legendNode2 [ label = "Shared Library", shape = doubleoctagon ]; + legendNode3 [ label = "Module Library", shape = tripleoctagon ]; + legendNode4 [ label = "Interface Library", shape = pentagon ]; + legendNode5 [ label = "Object Library", shape = hexagon ]; + legendNode6 [ label = "Unknown Library", shape = septagon ]; + legendNode7 [ label = "Custom Target", shape = box ]; + legendNode0 -> legendNode1 [ style = solid ]; + legendNode0 -> legendNode2 [ style = solid ]; + legendNode0 -> legendNode3; + legendNode1 -> legendNode4 [ label = "Interface", style = dashed ]; + legendNode2 -> legendNode5 [ label = "Private", style = dotted ]; + legendNode3 -> legendNode6 [ style = solid ]; + legendNode0 -> legendNode7; +} + "node0" [ label = "CompilerFlags", shape = pentagon ]; + "node1" [ label = "ConsoleApplication", shape = egg ]; + "node2" [ label = "CoreLibrary", shape = octagon ]; + "node2" -> "node0" // CoreLibrary -> CompilerFlags + "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; + "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary + "node4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node1" -> "node4" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node5" [ label = "GraphicApplication", shape = egg ]; + "node5" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node6" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node7" [ label = "\"-lm\"", shape = septagon ]; + "node6" -> "node7" [ style = dotted ] // GraphicLibrary -> "-lm" + "node6" -> "node0" // GraphicLibrary -> CompilerFlags + "node6" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node8" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node6" -> "node8" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node5" -> "node6" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node9" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node9" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node9" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node10" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node10" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary +} diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_executables.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_executables.dot new file mode 100644 index 0000000..558a470 --- /dev/null +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_executables.dot @@ -0,0 +1,44 @@ +digraph "GraphvizTestProject" { +node [ + fontsize = "12" +]; +subgraph clusterLegend { + label = "Legend"; + color = black; + edge [ style = invis ]; + legendNode0 [ label = "Executable", shape = egg ]; + legendNode1 [ label = "Static Library", shape = octagon ]; + legendNode2 [ label = "Shared Library", shape = doubleoctagon ]; + legendNode3 [ label = "Module Library", shape = tripleoctagon ]; + legendNode4 [ label = "Interface Library", shape = pentagon ]; + legendNode5 [ label = "Object Library", shape = hexagon ]; + legendNode6 [ label = "Unknown Library", shape = septagon ]; + legendNode7 [ label = "Custom Target", shape = box ]; + legendNode0 -> legendNode1 [ style = solid ]; + legendNode0 -> legendNode2 [ style = solid ]; + legendNode0 -> legendNode3; + legendNode1 -> legendNode4 [ label = "Interface", style = dashed ]; + legendNode2 -> legendNode5 [ label = "Private", style = dotted ]; + legendNode3 -> legendNode6 [ style = solid ]; + legendNode0 -> legendNode7; +} + "node0" [ label = "CompilerFlags", shape = pentagon ]; + "node1" [ label = "CoreLibrary", shape = octagon ]; + "node1" -> "node0" // CoreLibrary -> CompilerFlags + "node2" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; + "node1" -> "node2" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node3" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node4" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node5" [ label = "\"-lm\"", shape = septagon ]; + "node4" -> "node5" [ style = dotted ] // GraphicLibrary -> "-lm" + "node4" -> "node0" // GraphicLibrary -> CompilerFlags + "node4" -> "node1" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node6" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node4" -> "node6" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node7" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node7" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node7" -> "node1" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node8" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node8" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node8" -> "node1" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary +} diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_external_libs.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_external_libs.dot new file mode 100644 index 0000000..660af37 --- /dev/null +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_external_libs.dot @@ -0,0 +1,46 @@ +digraph "GraphvizTestProject" { +node [ + fontsize = "12" +]; +subgraph clusterLegend { + label = "Legend"; + color = black; + edge [ style = invis ]; + legendNode0 [ label = "Executable", shape = egg ]; + legendNode1 [ label = "Static Library", shape = octagon ]; + legendNode2 [ label = "Shared Library", shape = doubleoctagon ]; + legendNode3 [ label = "Module Library", shape = tripleoctagon ]; + legendNode4 [ label = "Interface Library", shape = pentagon ]; + legendNode5 [ label = "Object Library", shape = hexagon ]; + legendNode6 [ label = "Unknown Library", shape = septagon ]; + legendNode7 [ label = "Custom Target", shape = box ]; + legendNode0 -> legendNode1 [ style = solid ]; + legendNode0 -> legendNode2 [ style = solid ]; + legendNode0 -> legendNode3; + legendNode1 -> legendNode4 [ label = "Interface", style = dashed ]; + legendNode2 -> legendNode5 [ label = "Private", style = dotted ]; + legendNode3 -> legendNode6 [ style = solid ]; + legendNode0 -> legendNode7; +} + "node0" [ label = "CompilerFlags", shape = pentagon ]; + "node1" [ label = "ConsoleApplication", shape = egg ]; + "node2" [ label = "CoreLibrary", shape = octagon ]; + "node2" -> "node0" // CoreLibrary -> CompilerFlags + "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; + "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary + "node4" [ label = "GraphicApplication", shape = egg ]; + "node4" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node5" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node5" -> "node0" // GraphicLibrary -> CompilerFlags + "node5" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node6" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node5" -> "node6" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node4" -> "node5" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node7" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node7" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node7" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node8" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node8" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node8" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary +} diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_graphic_libs.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_graphic_libs.dot new file mode 100644 index 0000000..5af7fec --- /dev/null +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_graphic_libs.dot @@ -0,0 +1,35 @@ +digraph "GraphvizTestProject" { +node [ + fontsize = "12" +]; +subgraph clusterLegend { + label = "Legend"; + color = black; + edge [ style = invis ]; + legendNode0 [ label = "Executable", shape = egg ]; + legendNode1 [ label = "Static Library", shape = octagon ]; + legendNode2 [ label = "Shared Library", shape = doubleoctagon ]; + legendNode3 [ label = "Module Library", shape = tripleoctagon ]; + legendNode4 [ label = "Interface Library", shape = pentagon ]; + legendNode5 [ label = "Object Library", shape = hexagon ]; + legendNode6 [ label = "Unknown Library", shape = septagon ]; + legendNode7 [ label = "Custom Target", shape = box ]; + legendNode0 -> legendNode1 [ style = solid ]; + legendNode0 -> legendNode2 [ style = solid ]; + legendNode0 -> legendNode3; + legendNode1 -> legendNode4 [ label = "Interface", style = dashed ]; + legendNode2 -> legendNode5 [ label = "Private", style = dotted ]; + legendNode3 -> legendNode6 [ style = solid ]; + legendNode0 -> legendNode7; +} + "node0" [ label = "CompilerFlags", shape = pentagon ]; + "node1" [ label = "ConsoleApplication", shape = egg ]; + "node2" [ label = "CoreLibrary", shape = octagon ]; + "node2" -> "node0" // CoreLibrary -> CompilerFlags + "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; + "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary + "node4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node1" -> "node4" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node5" [ label = "\"-lm\"", shape = septagon ]; +} diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_interface_libs.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_interface_libs.dot new file mode 100644 index 0000000..94ec41c --- /dev/null +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_interface_libs.dot @@ -0,0 +1,43 @@ +digraph "GraphvizTestProject" { +node [ + fontsize = "12" +]; +subgraph clusterLegend { + label = "Legend"; + color = black; + edge [ style = invis ]; + legendNode0 [ label = "Executable", shape = egg ]; + legendNode1 [ label = "Static Library", shape = octagon ]; + legendNode2 [ label = "Shared Library", shape = doubleoctagon ]; + legendNode3 [ label = "Module Library", shape = tripleoctagon ]; + legendNode4 [ label = "Interface Library", shape = pentagon ]; + legendNode5 [ label = "Object Library", shape = hexagon ]; + legendNode6 [ label = "Unknown Library", shape = septagon ]; + legendNode7 [ label = "Custom Target", shape = box ]; + legendNode0 -> legendNode1 [ style = solid ]; + legendNode0 -> legendNode2 [ style = solid ]; + legendNode0 -> legendNode3; + legendNode1 -> legendNode4 [ label = "Interface", style = dashed ]; + legendNode2 -> legendNode5 [ label = "Private", style = dotted ]; + legendNode3 -> legendNode6 [ style = solid ]; + legendNode0 -> legendNode7; +} + "node0" [ label = "ConsoleApplication", shape = egg ]; + "node1" [ label = "CoreLibrary", shape = octagon ]; + "node0" -> "node1" [ style = dotted ] // ConsoleApplication -> CoreLibrary + "node2" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node0" -> "node2" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node3" [ label = "GraphicApplication", shape = egg ]; + "node3" -> "node1" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node4" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node5" [ label = "\"-lm\"", shape = septagon ]; + "node4" -> "node5" [ style = dotted ] // GraphicLibrary -> "-lm" + "node4" -> "node1" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node6" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node4" -> "node6" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node3" -> "node4" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node7" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node7" -> "node1" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node8" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node8" -> "node1" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary +} diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_module_libs.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_module_libs.dot new file mode 100644 index 0000000..65b7a71 --- /dev/null +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_module_libs.dot @@ -0,0 +1,44 @@ +digraph "GraphvizTestProject" { +node [ + fontsize = "12" +]; +subgraph clusterLegend { + label = "Legend"; + color = black; + edge [ style = invis ]; + legendNode0 [ label = "Executable", shape = egg ]; + legendNode1 [ label = "Static Library", shape = octagon ]; + legendNode2 [ label = "Shared Library", shape = doubleoctagon ]; + legendNode3 [ label = "Module Library", shape = tripleoctagon ]; + legendNode4 [ label = "Interface Library", shape = pentagon ]; + legendNode5 [ label = "Object Library", shape = hexagon ]; + legendNode6 [ label = "Unknown Library", shape = septagon ]; + legendNode7 [ label = "Custom Target", shape = box ]; + legendNode0 -> legendNode1 [ style = solid ]; + legendNode0 -> legendNode2 [ style = solid ]; + legendNode0 -> legendNode3; + legendNode1 -> legendNode4 [ label = "Interface", style = dashed ]; + legendNode2 -> legendNode5 [ label = "Private", style = dotted ]; + legendNode3 -> legendNode6 [ style = solid ]; + legendNode0 -> legendNode7; +} + "node0" [ label = "CompilerFlags", shape = pentagon ]; + "node1" [ label = "ConsoleApplication", shape = egg ]; + "node2" [ label = "CoreLibrary", shape = octagon ]; + "node2" -> "node0" // CoreLibrary -> CompilerFlags + "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; + "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary + "node4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node1" -> "node4" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node5" [ label = "GraphicApplication", shape = egg ]; + "node5" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node6" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node7" [ label = "\"-lm\"", shape = septagon ]; + "node6" -> "node7" [ style = dotted ] // GraphicLibrary -> "-lm" + "node6" -> "node0" // GraphicLibrary -> CompilerFlags + "node6" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node8" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node6" -> "node8" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node5" -> "node6" [ style = dotted ] // GraphicApplication -> GraphicLibrary +} diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_object_libs.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_object_libs.dot new file mode 100644 index 0000000..8116bc9 --- /dev/null +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_object_libs.dot @@ -0,0 +1,48 @@ +digraph "GraphvizTestProject" { +node [ + fontsize = "12" +]; +subgraph clusterLegend { + label = "Legend"; + color = black; + edge [ style = invis ]; + legendNode0 [ label = "Executable", shape = egg ]; + legendNode1 [ label = "Static Library", shape = octagon ]; + legendNode2 [ label = "Shared Library", shape = doubleoctagon ]; + legendNode3 [ label = "Module Library", shape = tripleoctagon ]; + legendNode4 [ label = "Interface Library", shape = pentagon ]; + legendNode5 [ label = "Object Library", shape = hexagon ]; + legendNode6 [ label = "Unknown Library", shape = septagon ]; + legendNode7 [ label = "Custom Target", shape = box ]; + legendNode0 -> legendNode1 [ style = solid ]; + legendNode0 -> legendNode2 [ style = solid ]; + legendNode0 -> legendNode3; + legendNode1 -> legendNode4 [ label = "Interface", style = dashed ]; + legendNode2 -> legendNode5 [ label = "Private", style = dotted ]; + legendNode3 -> legendNode6 [ style = solid ]; + legendNode0 -> legendNode7; +} + "node0" [ label = "CompilerFlags", shape = pentagon ]; + "node1" [ label = "ConsoleApplication", shape = egg ]; + "node2" [ label = "CoreLibrary", shape = octagon ]; + "node2" -> "node0" // CoreLibrary -> CompilerFlags + "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; + "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary + "node4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node1" -> "node4" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node5" [ label = "GraphicApplication", shape = egg ]; + "node5" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node6" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node7" [ label = "\"-lm\"", shape = septagon ]; + "node6" -> "node7" [ style = dotted ] // GraphicLibrary -> "-lm" + "node6" -> "node0" // GraphicLibrary -> CompilerFlags + "node6" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node5" -> "node6" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node8" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node8" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node8" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node9" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node9" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node9" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary +} diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_per_target_files.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_per_target_files.dot new file mode 100644 index 0000000..1bbf25a --- /dev/null +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_per_target_files.dot @@ -0,0 +1,50 @@ +digraph "GraphvizTestProject" { +node [ + fontsize = "12" +]; +subgraph clusterLegend { + label = "Legend"; + color = black; + edge [ style = invis ]; + legendNode0 [ label = "Executable", shape = egg ]; + legendNode1 [ label = "Static Library", shape = octagon ]; + legendNode2 [ label = "Shared Library", shape = doubleoctagon ]; + legendNode3 [ label = "Module Library", shape = tripleoctagon ]; + legendNode4 [ label = "Interface Library", shape = pentagon ]; + legendNode5 [ label = "Object Library", shape = hexagon ]; + legendNode6 [ label = "Unknown Library", shape = septagon ]; + legendNode7 [ label = "Custom Target", shape = box ]; + legendNode0 -> legendNode1 [ style = solid ]; + legendNode0 -> legendNode2 [ style = solid ]; + legendNode0 -> legendNode3; + legendNode1 -> legendNode4 [ label = "Interface", style = dashed ]; + legendNode2 -> legendNode5 [ label = "Private", style = dotted ]; + legendNode3 -> legendNode6 [ style = solid ]; + legendNode0 -> legendNode7; +} + "node0" [ label = "CompilerFlags", shape = pentagon ]; + "node1" [ label = "ConsoleApplication", shape = egg ]; + "node2" [ label = "CoreLibrary", shape = octagon ]; + "node2" -> "node0" // CoreLibrary -> CompilerFlags + "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; + "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary + "node4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node1" -> "node4" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node5" [ label = "GraphicApplication", shape = egg ]; + "node5" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node6" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node7" [ label = "\"-lm\"", shape = septagon ]; + "node6" -> "node7" [ style = dotted ] // GraphicLibrary -> "-lm" + "node6" -> "node0" // GraphicLibrary -> CompilerFlags + "node6" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node8" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node6" -> "node8" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node5" -> "node6" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node9" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node9" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node9" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node10" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node10" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary +} diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_shared_libs.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_shared_libs.dot new file mode 100644 index 0000000..439d1f7 --- /dev/null +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_shared_libs.dot @@ -0,0 +1,44 @@ +digraph "GraphvizTestProject" { +node [ + fontsize = "12" +]; +subgraph clusterLegend { + label = "Legend"; + color = black; + edge [ style = invis ]; + legendNode0 [ label = "Executable", shape = egg ]; + legendNode1 [ label = "Static Library", shape = octagon ]; + legendNode2 [ label = "Shared Library", shape = doubleoctagon ]; + legendNode3 [ label = "Module Library", shape = tripleoctagon ]; + legendNode4 [ label = "Interface Library", shape = pentagon ]; + legendNode5 [ label = "Object Library", shape = hexagon ]; + legendNode6 [ label = "Unknown Library", shape = septagon ]; + legendNode7 [ label = "Custom Target", shape = box ]; + legendNode0 -> legendNode1 [ style = solid ]; + legendNode0 -> legendNode2 [ style = solid ]; + legendNode0 -> legendNode3; + legendNode1 -> legendNode4 [ label = "Interface", style = dashed ]; + legendNode2 -> legendNode5 [ label = "Private", style = dotted ]; + legendNode3 -> legendNode6 [ style = solid ]; + legendNode0 -> legendNode7; +} + "node0" [ label = "CompilerFlags", shape = pentagon ]; + "node1" [ label = "ConsoleApplication", shape = egg ]; + "node2" [ label = "CoreLibrary", shape = octagon ]; + "node2" -> "node0" // CoreLibrary -> CompilerFlags + "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; + "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary + "node4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node1" -> "node4" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node5" [ label = "GraphicApplication", shape = egg ]; + "node5" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node6" [ label = "\"-lm\"", shape = septagon ]; + "node7" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node8" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node8" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node8" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node9" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node9" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node9" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary +} diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_static_libs.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_static_libs.dot new file mode 100644 index 0000000..81199a2 --- /dev/null +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_static_libs.dot @@ -0,0 +1,42 @@ +digraph "GraphvizTestProject" { +node [ + fontsize = "12" +]; +subgraph clusterLegend { + label = "Legend"; + color = black; + edge [ style = invis ]; + legendNode0 [ label = "Executable", shape = egg ]; + legendNode1 [ label = "Static Library", shape = octagon ]; + legendNode2 [ label = "Shared Library", shape = doubleoctagon ]; + legendNode3 [ label = "Module Library", shape = tripleoctagon ]; + legendNode4 [ label = "Interface Library", shape = pentagon ]; + legendNode5 [ label = "Object Library", shape = hexagon ]; + legendNode6 [ label = "Unknown Library", shape = septagon ]; + legendNode7 [ label = "Custom Target", shape = box ]; + legendNode0 -> legendNode1 [ style = solid ]; + legendNode0 -> legendNode2 [ style = solid ]; + legendNode0 -> legendNode3; + legendNode1 -> legendNode4 [ label = "Interface", style = dashed ]; + legendNode2 -> legendNode5 [ label = "Private", style = dotted ]; + legendNode3 -> legendNode6 [ style = solid ]; + legendNode0 -> legendNode7; +} + "node0" [ label = "CompilerFlags", shape = pentagon ]; + "node1" [ label = "ConsoleApplication", shape = egg ]; + "node2" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; + "node3" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node1" -> "node3" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node4" [ label = "GraphicApplication", shape = egg ]; + "node5" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node6" [ label = "\"-lm\"", shape = septagon ]; + "node5" -> "node6" [ style = dotted ] // GraphicLibrary -> "-lm" + "node5" -> "node0" // GraphicLibrary -> CompilerFlags + "node7" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node5" -> "node7" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node4" -> "node5" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node8" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node8" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node9" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node9" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags +} diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_unknown_libs.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_unknown_libs.dot new file mode 100644 index 0000000..1be6550 --- /dev/null +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_unknown_libs.dot @@ -0,0 +1,48 @@ +digraph "GraphvizTestProject" { +node [ + fontsize = "12" +]; +subgraph clusterLegend { + label = "Legend"; + color = black; + edge [ style = invis ]; + legendNode0 [ label = "Executable", shape = egg ]; + legendNode1 [ label = "Static Library", shape = octagon ]; + legendNode2 [ label = "Shared Library", shape = doubleoctagon ]; + legendNode3 [ label = "Module Library", shape = tripleoctagon ]; + legendNode4 [ label = "Interface Library", shape = pentagon ]; + legendNode5 [ label = "Object Library", shape = hexagon ]; + legendNode6 [ label = "Unknown Library", shape = septagon ]; + legendNode7 [ label = "Custom Target", shape = box ]; + legendNode0 -> legendNode1 [ style = solid ]; + legendNode0 -> legendNode2 [ style = solid ]; + legendNode0 -> legendNode3; + legendNode1 -> legendNode4 [ label = "Interface", style = dashed ]; + legendNode2 -> legendNode5 [ label = "Private", style = dotted ]; + legendNode3 -> legendNode6 [ style = solid ]; + legendNode0 -> legendNode7; +} + "node0" [ label = "CompilerFlags", shape = pentagon ]; + "node1" [ label = "ConsoleApplication", shape = egg ]; + "node2" [ label = "CoreLibrary", shape = octagon ]; + "node2" -> "node0" // CoreLibrary -> CompilerFlags + "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; + "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary + "node4" [ label = "GraphicApplication", shape = egg ]; + "node4" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node5" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node6" [ label = "\"-lm\"", shape = septagon ]; + "node5" -> "node6" [ style = dotted ] // GraphicLibrary -> "-lm" + "node5" -> "node0" // GraphicLibrary -> CompilerFlags + "node5" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node7" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node5" -> "node7" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node4" -> "node5" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node8" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node8" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node8" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node9" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node9" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node9" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary +} diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_graph_header.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_graph_header.dot new file mode 100644 index 0000000..1cfbe0f --- /dev/null +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_graph_header.dot @@ -0,0 +1,50 @@ +digraph "GraphvizTestProject" { +node [ + fontsize = "16" +]; +subgraph clusterLegend { + label = "Legend"; + color = black; + edge [ style = invis ]; + legendNode0 [ label = "Executable", shape = egg ]; + legendNode1 [ label = "Static Library", shape = octagon ]; + legendNode2 [ label = "Shared Library", shape = doubleoctagon ]; + legendNode3 [ label = "Module Library", shape = tripleoctagon ]; + legendNode4 [ label = "Interface Library", shape = pentagon ]; + legendNode5 [ label = "Object Library", shape = hexagon ]; + legendNode6 [ label = "Unknown Library", shape = septagon ]; + legendNode7 [ label = "Custom Target", shape = box ]; + legendNode0 -> legendNode1 [ style = solid ]; + legendNode0 -> legendNode2 [ style = solid ]; + legendNode0 -> legendNode3; + legendNode1 -> legendNode4 [ label = "Interface", style = dashed ]; + legendNode2 -> legendNode5 [ label = "Private", style = dotted ]; + legendNode3 -> legendNode6 [ style = solid ]; + legendNode0 -> legendNode7; +} + "node0" [ label = "CompilerFlags", shape = pentagon ]; + "node1" [ label = "ConsoleApplication", shape = egg ]; + "node2" [ label = "CoreLibrary", shape = octagon ]; + "node2" -> "node0" // CoreLibrary -> CompilerFlags + "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; + "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary + "node4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node1" -> "node4" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node5" [ label = "GraphicApplication", shape = egg ]; + "node5" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node6" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node7" [ label = "\"-lm\"", shape = septagon ]; + "node6" -> "node7" [ style = dotted ] // GraphicLibrary -> "-lm" + "node6" -> "node0" // GraphicLibrary -> CompilerFlags + "node6" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node8" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node6" -> "node8" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node5" -> "node6" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node9" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node9" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node9" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node10" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node10" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary +} diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_graph_name.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_graph_name.dot new file mode 100644 index 0000000..9653c33 --- /dev/null +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_graph_name.dot @@ -0,0 +1,50 @@ +digraph "CMake Project Dependencies" { +node [ + fontsize = "12" +]; +subgraph clusterLegend { + label = "Legend"; + color = black; + edge [ style = invis ]; + legendNode0 [ label = "Executable", shape = egg ]; + legendNode1 [ label = "Static Library", shape = octagon ]; + legendNode2 [ label = "Shared Library", shape = doubleoctagon ]; + legendNode3 [ label = "Module Library", shape = tripleoctagon ]; + legendNode4 [ label = "Interface Library", shape = pentagon ]; + legendNode5 [ label = "Object Library", shape = hexagon ]; + legendNode6 [ label = "Unknown Library", shape = septagon ]; + legendNode7 [ label = "Custom Target", shape = box ]; + legendNode0 -> legendNode1 [ style = solid ]; + legendNode0 -> legendNode2 [ style = solid ]; + legendNode0 -> legendNode3; + legendNode1 -> legendNode4 [ label = "Interface", style = dashed ]; + legendNode2 -> legendNode5 [ label = "Private", style = dotted ]; + legendNode3 -> legendNode6 [ style = solid ]; + legendNode0 -> legendNode7; +} + "node0" [ label = "CompilerFlags", shape = pentagon ]; + "node1" [ label = "ConsoleApplication", shape = egg ]; + "node2" [ label = "CoreLibrary", shape = octagon ]; + "node2" -> "node0" // CoreLibrary -> CompilerFlags + "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; + "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary + "node4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "node1" -> "node4" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "node5" [ label = "GraphicApplication", shape = egg ]; + "node5" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "node6" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "node7" [ label = "\"-lm\"", shape = septagon ]; + "node6" -> "node7" [ style = dotted ] // GraphicLibrary -> "-lm" + "node6" -> "node0" // GraphicLibrary -> CompilerFlags + "node6" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "node8" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "node6" -> "node8" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "node5" -> "node6" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node9" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "node9" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "node9" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "node10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "node10" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node10" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary +} diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_node_prefix.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_node_prefix.dot new file mode 100644 index 0000000..82d96d0 --- /dev/null +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_node_prefix.dot @@ -0,0 +1,50 @@ +digraph "GraphvizTestProject" { +node [ + fontsize = "12" +]; +subgraph clusterLegend { + label = "Legend"; + color = black; + edge [ style = invis ]; + legendNode0 [ label = "Executable", shape = egg ]; + legendNode1 [ label = "Static Library", shape = octagon ]; + legendNode2 [ label = "Shared Library", shape = doubleoctagon ]; + legendNode3 [ label = "Module Library", shape = tripleoctagon ]; + legendNode4 [ label = "Interface Library", shape = pentagon ]; + legendNode5 [ label = "Object Library", shape = hexagon ]; + legendNode6 [ label = "Unknown Library", shape = septagon ]; + legendNode7 [ label = "Custom Target", shape = box ]; + legendNode0 -> legendNode1 [ style = solid ]; + legendNode0 -> legendNode2 [ style = solid ]; + legendNode0 -> legendNode3; + legendNode1 -> legendNode4 [ label = "Interface", style = dashed ]; + legendNode2 -> legendNode5 [ label = "Private", style = dotted ]; + legendNode3 -> legendNode6 [ style = solid ]; + legendNode0 -> legendNode7; +} + "point0" [ label = "CompilerFlags", shape = pentagon ]; + "point1" [ label = "ConsoleApplication", shape = egg ]; + "point2" [ label = "CoreLibrary", shape = octagon ]; + "point2" -> "point0" // CoreLibrary -> CompilerFlags + "point3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ]; + "point2" -> "point3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary + "point1" -> "point2" [ style = dotted ] // ConsoleApplication -> CoreLibrary + "point4" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; + "point1" -> "point4" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary + "point5" [ label = "GraphicApplication", shape = egg ]; + "point5" -> "point2" [ style = dotted ] // GraphicApplication -> CoreLibrary + "point6" [ label = "GraphicLibrary", shape = doubleoctagon ]; + "point7" [ label = "\"-lm\"", shape = septagon ]; + "point6" -> "point7" [ style = dotted ] // GraphicLibrary -> "-lm" + "point6" -> "point0" // GraphicLibrary -> CompilerFlags + "point6" -> "point2" [ style = dotted ] // GraphicLibrary -> CoreLibrary + "point8" [ label = "GraphicLibraryObjects", shape = hexagon ]; + "point6" -> "point8" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects + "point5" -> "point6" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "point9" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ]; + "point9" -> "point0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags + "point9" -> "point2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary + "point10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; + "point10" -> "point0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "point10" -> "point2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary +} diff --git a/Tests/RunCMake/Graphviz/no_dependers_files-check.cmake b/Tests/RunCMake/Graphviz/no_dependers_files-check.cmake new file mode 100644 index 0000000..f4a43b6 --- /dev/null +++ b/Tests/RunCMake/Graphviz/no_dependers_files-check.cmake @@ -0,0 +1,4 @@ +file(GLOB dependers_files ${RunCMake_TEST_BINARY_DIR}/*.dependers) +if(${dependers_files}) + set(RunCMake_TEST_FAILED "Found *.dependers files despite GRAPHVIZ_GENERATE_DEPENDERS set to FALSE.") +endif() diff --git a/Tests/RunCMake/Graphviz/no_executables-check.cmake b/Tests/RunCMake/Graphviz/no_executables-check.cmake new file mode 100644 index 0000000..be29a4f --- /dev/null +++ b/Tests/RunCMake/Graphviz/no_executables-check.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +ensure_files_match( + ${RunCMake_TEST_SOURCE_DIR}/expected_outputs/dependency_graph_no_executables.dot + ${RunCMake_TEST_BINARY_DIR}/generated_dependency_graph.dot) diff --git a/Tests/RunCMake/Graphviz/no_external_libs-check.cmake b/Tests/RunCMake/Graphviz/no_external_libs-check.cmake new file mode 100644 index 0000000..518ef7b --- /dev/null +++ b/Tests/RunCMake/Graphviz/no_external_libs-check.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +ensure_files_match( + ${RunCMake_TEST_SOURCE_DIR}/expected_outputs/dependency_graph_no_external_libs.dot + ${RunCMake_TEST_BINARY_DIR}/generated_dependency_graph.dot) diff --git a/Tests/RunCMake/Graphviz/no_graphic_libs-check.cmake b/Tests/RunCMake/Graphviz/no_graphic_libs-check.cmake new file mode 100644 index 0000000..0f5aa47 --- /dev/null +++ b/Tests/RunCMake/Graphviz/no_graphic_libs-check.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +ensure_files_match( + ${RunCMake_TEST_SOURCE_DIR}/expected_outputs/dependency_graph_no_graphic_libs.dot + ${RunCMake_TEST_BINARY_DIR}/generated_dependency_graph.dot) diff --git a/Tests/RunCMake/Graphviz/no_interface_libs-check.cmake b/Tests/RunCMake/Graphviz/no_interface_libs-check.cmake new file mode 100644 index 0000000..018fef0 --- /dev/null +++ b/Tests/RunCMake/Graphviz/no_interface_libs-check.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +ensure_files_match( + ${RunCMake_TEST_SOURCE_DIR}/expected_outputs/dependency_graph_no_interface_libs.dot + ${RunCMake_TEST_BINARY_DIR}/generated_dependency_graph.dot) diff --git a/Tests/RunCMake/Graphviz/no_module_libs-check.cmake b/Tests/RunCMake/Graphviz/no_module_libs-check.cmake new file mode 100644 index 0000000..e185cb1 --- /dev/null +++ b/Tests/RunCMake/Graphviz/no_module_libs-check.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +ensure_files_match( + ${RunCMake_TEST_SOURCE_DIR}/expected_outputs/dependency_graph_no_module_libs.dot + ${RunCMake_TEST_BINARY_DIR}/generated_dependency_graph.dot) diff --git a/Tests/RunCMake/Graphviz/no_object_libs-check.cmake b/Tests/RunCMake/Graphviz/no_object_libs-check.cmake new file mode 100644 index 0000000..90e7ecb --- /dev/null +++ b/Tests/RunCMake/Graphviz/no_object_libs-check.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +ensure_files_match( + ${RunCMake_TEST_SOURCE_DIR}/expected_outputs/dependency_graph_no_object_libs.dot + ${RunCMake_TEST_BINARY_DIR}/generated_dependency_graph.dot) diff --git a/Tests/RunCMake/Graphviz/no_per_target_files-check.cmake b/Tests/RunCMake/Graphviz/no_per_target_files-check.cmake new file mode 100644 index 0000000..95d05a1 --- /dev/null +++ b/Tests/RunCMake/Graphviz/no_per_target_files-check.cmake @@ -0,0 +1,5 @@ +file(GLOB per_target_files ${RunCMake_TEST_BINARY_DIR}/*.dot.*) +list(FILTER per_target_files EXCLUDE REGEX ".*\\.dependers$") +if(per_target_files) + set(RunCMake_TEST_FAILED "Found per-target .dot files despite GRAPHVIZ_GENERATE_PER_TARGET set to FALSE.") +endif() diff --git a/Tests/RunCMake/Graphviz/no_shared_libs-check.cmake b/Tests/RunCMake/Graphviz/no_shared_libs-check.cmake new file mode 100644 index 0000000..b45da2e --- /dev/null +++ b/Tests/RunCMake/Graphviz/no_shared_libs-check.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +ensure_files_match( + ${RunCMake_TEST_SOURCE_DIR}/expected_outputs/dependency_graph_no_shared_libs.dot + ${RunCMake_TEST_BINARY_DIR}/generated_dependency_graph.dot) diff --git a/Tests/RunCMake/Graphviz/no_static_libs-check.cmake b/Tests/RunCMake/Graphviz/no_static_libs-check.cmake new file mode 100644 index 0000000..befc11b --- /dev/null +++ b/Tests/RunCMake/Graphviz/no_static_libs-check.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +ensure_files_match( + ${RunCMake_TEST_SOURCE_DIR}/expected_outputs/dependency_graph_no_static_libs.dot + ${RunCMake_TEST_BINARY_DIR}/generated_dependency_graph.dot) diff --git a/Tests/RunCMake/Graphviz/no_unknown_libs-check.cmake b/Tests/RunCMake/Graphviz/no_unknown_libs-check.cmake new file mode 100644 index 0000000..95286bc --- /dev/null +++ b/Tests/RunCMake/Graphviz/no_unknown_libs-check.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +ensure_files_match( + ${RunCMake_TEST_SOURCE_DIR}/expected_outputs/dependency_graph_no_unknown_libs.dot + ${RunCMake_TEST_BINARY_DIR}/generated_dependency_graph.dot) diff --git a/Tests/RunCMake/Graphviz/set_graph_header-check.cmake b/Tests/RunCMake/Graphviz/set_graph_header-check.cmake new file mode 100644 index 0000000..1396484 --- /dev/null +++ b/Tests/RunCMake/Graphviz/set_graph_header-check.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +ensure_files_match( + ${RunCMake_TEST_SOURCE_DIR}/expected_outputs/dependency_graph_set_graph_header.dot + ${RunCMake_TEST_BINARY_DIR}/generated_dependency_graph.dot) diff --git a/Tests/RunCMake/Graphviz/set_graph_name-check.cmake b/Tests/RunCMake/Graphviz/set_graph_name-check.cmake new file mode 100644 index 0000000..0c522e9 --- /dev/null +++ b/Tests/RunCMake/Graphviz/set_graph_name-check.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +ensure_files_match( + ${RunCMake_TEST_SOURCE_DIR}/expected_outputs/dependency_graph_set_graph_name.dot + ${RunCMake_TEST_BINARY_DIR}/generated_dependency_graph.dot) diff --git a/Tests/RunCMake/Graphviz/set_node_prefix-check.cmake b/Tests/RunCMake/Graphviz/set_node_prefix-check.cmake new file mode 100644 index 0000000..61e9b24 --- /dev/null +++ b/Tests/RunCMake/Graphviz/set_node_prefix-check.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +ensure_files_match( + ${RunCMake_TEST_SOURCE_DIR}/expected_outputs/dependency_graph_set_node_prefix.dot + ${RunCMake_TEST_BINARY_DIR}/generated_dependency_graph.dot) diff --git a/Tests/RunCMake/Graphviz/test_project/core_library.c b/Tests/RunCMake/Graphviz/test_project/core_library.c new file mode 100644 index 0000000..e8a8844 --- /dev/null +++ b/Tests/RunCMake/Graphviz/test_project/core_library.c @@ -0,0 +1,3 @@ +void log_something() +{ +} diff --git a/Tests/RunCMake/Graphviz/test_project/graphic_library.c b/Tests/RunCMake/Graphviz/test_project/graphic_library.c new file mode 100644 index 0000000..958c8ab --- /dev/null +++ b/Tests/RunCMake/Graphviz/test_project/graphic_library.c @@ -0,0 +1,3 @@ +void initialize_graphics() +{ +} diff --git a/Tests/RunCMake/Graphviz/test_project/main.c b/Tests/RunCMake/Graphviz/test_project/main.c new file mode 100644 index 0000000..d123e09 --- /dev/null +++ b/Tests/RunCMake/Graphviz/test_project/main.c @@ -0,0 +1,4 @@ +int main(int argc, char** argv) +{ + return 0; +} diff --git a/Tests/RunCMake/Graphviz/test_project/module.c b/Tests/RunCMake/Graphviz/test_project/module.c new file mode 100644 index 0000000..a508b09 --- /dev/null +++ b/Tests/RunCMake/Graphviz/test_project/module.c @@ -0,0 +1,3 @@ +static void some_function() +{ +} diff --git a/Tests/RunCMake/Graphviz/test_project/third_party_project/CMakeLists.txt b/Tests/RunCMake/Graphviz/test_project/third_party_project/CMakeLists.txt new file mode 100644 index 0000000..e381750 --- /dev/null +++ b/Tests/RunCMake/Graphviz/test_project/third_party_project/CMakeLists.txt @@ -0,0 +1,3 @@ +project(ThirdPartyProject) + +add_library(GoofyLoggingLibrary INTERFACE) diff --git a/Tests/RunCMake/INSTALL_NAME_DIR/CMakeLists.txt b/Tests/RunCMake/INSTALL_NAME_DIR/CMakeLists.txt new file mode 100644 index 0000000..5253d34 --- /dev/null +++ b/Tests/RunCMake/INSTALL_NAME_DIR/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.16) +project(${RunCMake_TEST} NONE) +include(${CMAKE_CURRENT_LIST_DIR}/INSTALL_NAME_DIR.cmake) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/INSTALL_NAME_DIR/INSTALL_NAME_DIR.cmake b/Tests/RunCMake/INSTALL_NAME_DIR/INSTALL_NAME_DIR.cmake new file mode 100644 index 0000000..eaa0b45 --- /dev/null +++ b/Tests/RunCMake/INSTALL_NAME_DIR/INSTALL_NAME_DIR.cmake @@ -0,0 +1,15 @@ +function(add_install_name_dir_libraries install_name_dir) + add_library(build_dir SHARED test.c) + add_library(install_dir SHARED test.c) + if(NOT install_name_dir STREQUAL "NONE") + set_target_properties(build_dir install_dir PROPERTIES + INSTALL_NAME_DIR "${install_name_dir}" + ) + endif() + set_target_properties(install_dir PROPERTIES + BUILD_WITH_INSTALL_NAME_DIR TRUE + ) + install(TARGETS build_dir install_dir EXPORT InstallNameDirTest DESTINATION lib) + install(EXPORT InstallNameDirTest DESTINATION lib/cmake/InstallNameDirTest FILE InstallNameDirTest-targets.cmake) + file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/targets.txt" CONTENT "$<TARGET_FILE:build_dir>\n$<TARGET_FILE:install_dir>\n" CONDITION $<CONFIG:Debug>) +endfunction() diff --git a/Tests/RunCMake/INSTALL_NAME_DIR/RunCMakeTest.cmake b/Tests/RunCMake/INSTALL_NAME_DIR/RunCMakeTest.cmake new file mode 100644 index 0000000..2aa03dd --- /dev/null +++ b/Tests/RunCMake/INSTALL_NAME_DIR/RunCMakeTest.cmake @@ -0,0 +1,69 @@ +cmake_minimum_required(VERSION 3.16) + +include(RunCMake) + +function(run_install_test case) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE:STRING=Debug "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/fake_install") + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(${case}) + run_cmake_command(${case}-build ${CMAKE_COMMAND} --build . --config Debug) + run_cmake_command(${case}-install ${CMAKE_COMMAND} --install . --config Debug --prefix "${RunCMake_TEST_BINARY_DIR}/real_install") +endfunction() + +find_program(OTOOL_COMMAND otool) + +function(check_install_name_dir file expected) + execute_process(COMMAND ${OTOOL_COMMAND} -l ${file} RESULT_VARIABLE _result OUTPUT_VARIABLE _output) + if(_result) + string(APPEND RunCMake_TEST_FAILED "Could not run otool on ${file}\n") + elseif(_output MATCHES "cmd LC_ID_DYLIB\n[^\n]*\n *name ([^\n]*) \\(offset [0-9]+\\)\n") + set(_install_name "${CMAKE_MATCH_1}") + if(NOT _install_name MATCHES "${expected}") + string(APPEND RunCMake_TEST_FAILED "Install name of ${file} did not match ${expected} (actual: ${_install_name})\n") + endif() + else() + string(APPEND RunCMake_TEST_FAILED "otool did not print install name for ${file}\n") + endif() + + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) +endfunction() + +function(check_imported_soname contents target expected) + if(contents MATCHES "set_target_properties\\(${target} PROPERTIES\n[^\n]*\n *IMPORTED_SONAME_DEBUG \"([^\n]*)\"\n") + set(_soname "${CMAKE_MATCH_1}") + set(_regex "^${expected}lib${target}\\.dylib$") + if(NOT _soname MATCHES "${_regex}") + string(APPEND RunCMake_TEST_FAILED "Target ${target}'s IMPORTED_SONAME_DEBUG did not match ${_regex} (actual: ${_soname})\n") + endif() + else() + string(APPEND RunCMake_TEST_FAILED "Could not find IMPORTED_SONAME_DEBUG for target ${target} in package config file\n") + endif() + + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) +endfunction() + +function(check_libraries fake_install real_install soname_prefix) + file(STRINGS "${RunCMake_TEST_BINARY_DIR}/targets.txt" _targets) + list(GET _targets 0 _build_dir) + list(GET _targets 1 _install_dir) + check_install_name_dir("${_build_dir}" "^@rpath/libbuild_dir\\.dylib$") + check_install_name_dir("${_install_dir}" "^${fake_install}libinstall_dir\\.dylib$") + check_install_name_dir("${RunCMake_TEST_BINARY_DIR}/real_install/lib/libbuild_dir.dylib" "^${real_install}libbuild_dir\\.dylib$") + check_install_name_dir("${RunCMake_TEST_BINARY_DIR}/real_install/lib/libinstall_dir.dylib" "^${real_install}libinstall_dir\\.dylib$") + + file(READ "${RunCMake_TEST_BINARY_DIR}/real_install/lib/cmake/InstallNameDirTest/InstallNameDirTest-targets-debug.cmake" _targets) + check_imported_soname("${_targets}" build_dir "${soname_prefix}") + check_imported_soname("${_targets}" install_dir "${soname_prefix}") + + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) +endfunction() + +run_install_test(none) +run_install_test(empty) +run_install_test(simple) +run_install_test(simple_genex) +run_install_test(prefix_genex) +run_install_test(empty_genex) diff --git a/Tests/RunCMake/INSTALL_NAME_DIR/empty-install-check.cmake b/Tests/RunCMake/INSTALL_NAME_DIR/empty-install-check.cmake new file mode 100644 index 0000000..db87d2c --- /dev/null +++ b/Tests/RunCMake/INSTALL_NAME_DIR/empty-install-check.cmake @@ -0,0 +1 @@ +check_libraries("" "" "") diff --git a/Tests/RunCMake/INSTALL_NAME_DIR/empty.cmake b/Tests/RunCMake/INSTALL_NAME_DIR/empty.cmake new file mode 100644 index 0000000..0cde4d1 --- /dev/null +++ b/Tests/RunCMake/INSTALL_NAME_DIR/empty.cmake @@ -0,0 +1,3 @@ +enable_language(C) + +add_install_name_dir_libraries("") diff --git a/Tests/RunCMake/INSTALL_NAME_DIR/empty_genex-install-check.cmake b/Tests/RunCMake/INSTALL_NAME_DIR/empty_genex-install-check.cmake new file mode 100644 index 0000000..db87d2c --- /dev/null +++ b/Tests/RunCMake/INSTALL_NAME_DIR/empty_genex-install-check.cmake @@ -0,0 +1 @@ +check_libraries("" "" "") diff --git a/Tests/RunCMake/INSTALL_NAME_DIR/empty_genex.cmake b/Tests/RunCMake/INSTALL_NAME_DIR/empty_genex.cmake new file mode 100644 index 0000000..321c8d1 --- /dev/null +++ b/Tests/RunCMake/INSTALL_NAME_DIR/empty_genex.cmake @@ -0,0 +1,3 @@ +enable_language(C) + +add_install_name_dir_libraries($<0:/usr/local/lib>) diff --git a/Tests/RunCMake/INSTALL_NAME_DIR/none-install-check.cmake b/Tests/RunCMake/INSTALL_NAME_DIR/none-install-check.cmake new file mode 100644 index 0000000..c3e7ac4 --- /dev/null +++ b/Tests/RunCMake/INSTALL_NAME_DIR/none-install-check.cmake @@ -0,0 +1 @@ +check_libraries(@rpath/ @rpath/ @rpath/) diff --git a/Tests/RunCMake/INSTALL_NAME_DIR/none.cmake b/Tests/RunCMake/INSTALL_NAME_DIR/none.cmake new file mode 100644 index 0000000..79c5e7d --- /dev/null +++ b/Tests/RunCMake/INSTALL_NAME_DIR/none.cmake @@ -0,0 +1,3 @@ +enable_language(C) + +add_install_name_dir_libraries(NONE) diff --git a/Tests/RunCMake/INSTALL_NAME_DIR/prefix_genex-install-check.cmake b/Tests/RunCMake/INSTALL_NAME_DIR/prefix_genex-install-check.cmake new file mode 100644 index 0000000..8cf7db8 --- /dev/null +++ b/Tests/RunCMake/INSTALL_NAME_DIR/prefix_genex-install-check.cmake @@ -0,0 +1,6 @@ +check_libraries( + ".*/Tests/RunCMake/INSTALL_NAME_DIR/prefix_genex-build/fake_install/lib/" + ".*/Tests/RunCMake/INSTALL_NAME_DIR/prefix_genex-build/real_install/lib/" + # "$" has to be escaped twice because of its significance in regexes. + "\\\${_IMPORT_PREFIX}/lib/" + ) diff --git a/Tests/RunCMake/INSTALL_NAME_DIR/prefix_genex.cmake b/Tests/RunCMake/INSTALL_NAME_DIR/prefix_genex.cmake new file mode 100644 index 0000000..7e26208 --- /dev/null +++ b/Tests/RunCMake/INSTALL_NAME_DIR/prefix_genex.cmake @@ -0,0 +1,3 @@ +enable_language(C) + +add_install_name_dir_libraries($<1:$<INSTALL_PREFIX>/lib>) diff --git a/Tests/RunCMake/INSTALL_NAME_DIR/simple-install-check.cmake b/Tests/RunCMake/INSTALL_NAME_DIR/simple-install-check.cmake new file mode 100644 index 0000000..5f737cb --- /dev/null +++ b/Tests/RunCMake/INSTALL_NAME_DIR/simple-install-check.cmake @@ -0,0 +1 @@ +check_libraries(/usr/local/lib/ /usr/local/lib/ /usr/local/lib/) diff --git a/Tests/RunCMake/INSTALL_NAME_DIR/simple.cmake b/Tests/RunCMake/INSTALL_NAME_DIR/simple.cmake new file mode 100644 index 0000000..d019875 --- /dev/null +++ b/Tests/RunCMake/INSTALL_NAME_DIR/simple.cmake @@ -0,0 +1,3 @@ +enable_language(C) + +add_install_name_dir_libraries(/usr/local/lib) diff --git a/Tests/RunCMake/INSTALL_NAME_DIR/simple_genex-install-check.cmake b/Tests/RunCMake/INSTALL_NAME_DIR/simple_genex-install-check.cmake new file mode 100644 index 0000000..5f737cb --- /dev/null +++ b/Tests/RunCMake/INSTALL_NAME_DIR/simple_genex-install-check.cmake @@ -0,0 +1 @@ +check_libraries(/usr/local/lib/ /usr/local/lib/ /usr/local/lib/) diff --git a/Tests/RunCMake/INSTALL_NAME_DIR/simple_genex.cmake b/Tests/RunCMake/INSTALL_NAME_DIR/simple_genex.cmake new file mode 100644 index 0000000..1e729e8 --- /dev/null +++ b/Tests/RunCMake/INSTALL_NAME_DIR/simple_genex.cmake @@ -0,0 +1,3 @@ +enable_language(C) + +add_install_name_dir_libraries($<1:/usr/local/lib>) diff --git a/Tests/RunCMake/INSTALL_NAME_DIR/test.c b/Tests/RunCMake/INSTALL_NAME_DIR/test.c new file mode 100644 index 0000000..c2db61c --- /dev/null +++ b/Tests/RunCMake/INSTALL_NAME_DIR/test.c @@ -0,0 +1,3 @@ +void test(void) +{ +} diff --git a/Tests/RunCMake/MaxRecursionDepth/variable_watch-default-script-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/variable_watch-default-script-stderr.txt index 4dddc96..07deee2 100644 --- a/Tests/RunCMake/MaxRecursionDepth/variable_watch-default-script-stderr.txt +++ b/Tests/RunCMake/MaxRecursionDepth/variable_watch-default-script-stderr.txt @@ -1,6 +1,6 @@ [0-9]+ -CMake Error at .*/variable_watch\.cmake:9999 \(update_x\): +CMake Error at .*/variable_watch\.cmake:[0-9]+ \(update_x\): Maximum recursion depth of [0-9]+ exceeded Call Stack \(most recent call first\): .*/variable_watch\.cmake:5 \(set\) - .*/variable_watch\.cmake:9999 \(update_x\) + .*/variable_watch\.cmake:[0-9]+ \(update_x\) diff --git a/Tests/RunCMake/MaxRecursionDepth/variable_watch-default-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/variable_watch-default-stderr.txt index a8b4756..b2395b3 100644 --- a/Tests/RunCMake/MaxRecursionDepth/variable_watch-default-stderr.txt +++ b/Tests/RunCMake/MaxRecursionDepth/variable_watch-default-stderr.txt @@ -1,6 +1,6 @@ [0-9]+ -CMake Error at variable_watch\.cmake:9999 \(update_x\): +CMake Error at variable_watch\.cmake:[0-9]+ \(update_x\): Maximum recursion depth of [0-9]+ exceeded Call Stack \(most recent call first\): variable_watch\.cmake:5 \(set\) - variable_watch\.cmake:9999 \(update_x\) + variable_watch\.cmake:[0-9]+ \(update_x\) diff --git a/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-var-script-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-var-script-stderr.txt index 4dddc96..07deee2 100644 --- a/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-var-script-stderr.txt +++ b/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-var-script-stderr.txt @@ -1,6 +1,6 @@ [0-9]+ -CMake Error at .*/variable_watch\.cmake:9999 \(update_x\): +CMake Error at .*/variable_watch\.cmake:[0-9]+ \(update_x\): Maximum recursion depth of [0-9]+ exceeded Call Stack \(most recent call first\): .*/variable_watch\.cmake:5 \(set\) - .*/variable_watch\.cmake:9999 \(update_x\) + .*/variable_watch\.cmake:[0-9]+ \(update_x\) diff --git a/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-var-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-var-stderr.txt index a8b4756..b2395b3 100644 --- a/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-var-stderr.txt +++ b/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-var-stderr.txt @@ -1,6 +1,6 @@ [0-9]+ -CMake Error at variable_watch\.cmake:9999 \(update_x\): +CMake Error at variable_watch\.cmake:[0-9]+ \(update_x\): Maximum recursion depth of [0-9]+ exceeded Call Stack \(most recent call first\): variable_watch\.cmake:5 \(set\) - variable_watch\.cmake:9999 \(update_x\) + variable_watch\.cmake:[0-9]+ \(update_x\) diff --git a/Tests/RunCMake/MaxRecursionDepth/variable_watch-var-script-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/variable_watch-var-script-stderr.txt index 00b2b3c..52fedd3 100644 --- a/Tests/RunCMake/MaxRecursionDepth/variable_watch-var-script-stderr.txt +++ b/Tests/RunCMake/MaxRecursionDepth/variable_watch-var-script-stderr.txt @@ -2,17 +2,17 @@ 6 8 10 -CMake Error at .*/variable_watch\.cmake:9999 \(update_x\): +CMake Error at .*/variable_watch\.cmake:[0-9]+ \(update_x\): Maximum recursion depth of 10 exceeded Call Stack \(most recent call first\): .*/variable_watch\.cmake:5 \(set\) - .*/variable_watch\.cmake:9999 \(update_x\) + .*/variable_watch\.cmake:[0-9]+ \(update_x\) .*/variable_watch\.cmake:5 \(set\) - .*/variable_watch\.cmake:9999 \(update_x\) + .*/variable_watch\.cmake:[0-9]+ \(update_x\) .*/variable_watch\.cmake:5 \(set\) - .*/variable_watch\.cmake:9999 \(update_x\) + .*/variable_watch\.cmake:[0-9]+ \(update_x\) .*/variable_watch\.cmake:5 \(set\) - .*/variable_watch\.cmake:9999 \(update_x\) + .*/variable_watch\.cmake:[0-9]+ \(update_x\) .*/variable_watch\.cmake:9 \(set\) .*/CMakeLists\.txt:5 \(include\) diff --git a/Tests/RunCMake/MaxRecursionDepth/variable_watch-var-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/variable_watch-var-stderr.txt index 8f27bf1..1427f1d 100644 --- a/Tests/RunCMake/MaxRecursionDepth/variable_watch-var-stderr.txt +++ b/Tests/RunCMake/MaxRecursionDepth/variable_watch-var-stderr.txt @@ -2,17 +2,17 @@ 6 8 10 -CMake Error at variable_watch\.cmake:9999 \(update_x\): +CMake Error at variable_watch\.cmake:[0-9]+ \(update_x\): Maximum recursion depth of 10 exceeded Call Stack \(most recent call first\): variable_watch\.cmake:5 \(set\) - variable_watch\.cmake:9999 \(update_x\) + variable_watch\.cmake:[0-9]+ \(update_x\) variable_watch\.cmake:5 \(set\) - variable_watch\.cmake:9999 \(update_x\) + variable_watch\.cmake:[0-9]+ \(update_x\) variable_watch\.cmake:5 \(set\) - variable_watch\.cmake:9999 \(update_x\) + variable_watch\.cmake:[0-9]+ \(update_x\) variable_watch\.cmake:5 \(set\) - variable_watch\.cmake:9999 \(update_x\) + variable_watch\.cmake:[0-9]+ \(update_x\) variable_watch\.cmake:9 \(set\) CMakeLists\.txt:5 \(include\) diff --git a/Tests/RunCMake/PrecompileHeaders/DisabledPch-check.cmake b/Tests/RunCMake/PrecompileHeaders/DisabledPch-check.cmake index 8cf0fc9..494bcf7 100644 --- a/Tests/RunCMake/PrecompileHeaders/DisabledPch-check.cmake +++ b/Tests/RunCMake/PrecompileHeaders/DisabledPch-check.cmake @@ -1,10 +1,5 @@ -if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) - set(foo_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foo.dir/CMakeFiles/foo.dir/cmake_pch.h") - set(foobar_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/CMakeFiles/foobar.dir/cmake_pch.h") -else() - set(foo_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foo.dir/cmake_pch.h") - set(foobar_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/cmake_pch.h") -endif() +set(foo_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foo.dir/cmake_pch.h") +set(foobar_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/cmake_pch.h") if (NOT EXISTS ${foo_pch_header}) set(RunCMake_TEST_FAILED "Generated foo pch header ${foo_pch_header} does not exist") diff --git a/Tests/RunCMake/PrecompileHeaders/PchInterface-check.cmake b/Tests/RunCMake/PrecompileHeaders/PchInterface-check.cmake index caeb22b..4e62b81 100644 --- a/Tests/RunCMake/PrecompileHeaders/PchInterface-check.cmake +++ b/Tests/RunCMake/PrecompileHeaders/PchInterface-check.cmake @@ -1,10 +1,5 @@ -if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) - set(foo_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foo.dir/CMakeFiles/foo.dir/cmake_pch.h") - set(foobar_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/CMakeFiles/foobar.dir/cmake_pch.h") -else() - set(foo_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foo.dir/cmake_pch.h") - set(foobar_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/cmake_pch.h") -endif() +set(foo_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foo.dir/cmake_pch.h") +set(foobar_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/cmake_pch.h") if (NOT EXISTS ${foo_pch_header}) set(RunCMake_TEST_FAILED "Generated foo pch header ${foo_pch_header} does not exist") diff --git a/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake index e0b753a..cc01ecb 100644 --- a/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake +++ b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake @@ -1,10 +1,5 @@ -if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) - set(foobar_pch_h_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/CMakeFiles/foobar.dir/cmake_pch.h") - set(foobar_pch_hxx_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/CMakeFiles/foobar.dir/cmake_pch.hxx") -else() - set(foobar_pch_h_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/cmake_pch.h") - set(foobar_pch_hxx_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/cmake_pch.hxx") -endif() +set(foobar_pch_h_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/cmake_pch.h") +set(foobar_pch_hxx_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/cmake_pch.hxx") if (NOT EXISTS ${foobar_pch_h_header}) set(RunCMake_TEST_FAILED "Generated foobar C pch header ${foobar_pch_h_header} does not exist") diff --git a/Tests/RunCMake/PrecompileHeaders/PchPrologueEpilogue-check.cmake b/Tests/RunCMake/PrecompileHeaders/PchPrologueEpilogue-check.cmake index ba220f3..9018664 100644 --- a/Tests/RunCMake/PrecompileHeaders/PchPrologueEpilogue-check.cmake +++ b/Tests/RunCMake/PrecompileHeaders/PchPrologueEpilogue-check.cmake @@ -1,8 +1,4 @@ -if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) - set(main_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/main.dir/CMakeFiles/main.dir/cmake_pch.hxx") -else() - set(main_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/main.dir/cmake_pch.hxx") -endif() +set(main_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/main.dir/cmake_pch.hxx") file(STRINGS ${main_pch_header} main_pch_header_strings) string(REGEX MATCH "#pragma warning\\(push, 0\\).*#include.*pch.h.*#pragma warning\\(pop\\)" matched_code ${main_pch_header_strings}) diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index da4d1e5..cb20fb1 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -146,6 +146,12 @@ function(run_cmake test) "|clang[^:]*: warning: the object size sanitizer has no effect at -O0, but is explicitly enabled:" "|Error kstat returned" "|Hit xcodebuild bug" + + "|LICENSE WARNING:" + "|Your license to use PGI[^\n]*expired" + "|Please obtain a new version at" + "|contact PGI Sales at" + "|[^\n]*xcodebuild[^\n]*warning: file type[^\n]*is based on missing file type" "|[^\n]*is a member of multiple groups" "|[^\n]*from Time Machine by path" @@ -204,5 +210,28 @@ function(run_cmake_with_options test) run_cmake(${test}) endfunction() +function(ensure_files_match expected_file actual_file) + if(NOT EXISTS "${expected_file}") + message(FATAL_ERROR "Expected file does not exist:\n ${expected_file}") + endif() + if(NOT EXISTS "${actual_file}") + message(FATAL_ERROR "Actual file does not exist:\n ${actual_file}") + endif() + file(READ "${expected_file}" expected_file_content) + file(READ "${actual_file}" actual_file_content) + if(NOT "${expected_file_content}" STREQUAL "${actual_file_content}") + message(FATAL_ERROR "Actual file content does not match expected:\n + \n + expected file: ${expected_file}\n + expected content:\n + ${expected_file_content}\n + \n + actual file: ${actual_file}\n + actual content:\n + ${actual_file_content}\n + ") + endif() +endfunction() + # Protect RunCMake tests from calling environment. unset(ENV{MAKEFLAGS}) diff --git a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake index bee8c4e..0d462ba 100644 --- a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake +++ b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake @@ -1,6 +1,6 @@ include(RunCMake) -if(RunCMake_GENERATOR MATCHES "Visual Studio|Xcode") +if(RunCMake_GENERATOR STREQUAL "Xcode") run_cmake(ConfigNotAllowed) endif() diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index 44ccd6b..1487161 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -15,6 +15,7 @@ run_cmake(VsDebuggerCommand) run_cmake(VsDebuggerCommandArguments) run_cmake(VsDebuggerEnvironment) run_cmake(VsCSharpCustomTags) +run_cmake(VsCSharpDocumentationFile) run_cmake(VsCSharpReferenceProps) run_cmake(VsCSharpWithoutSources) run_cmake(VsCSharpDeployFiles) @@ -28,6 +29,10 @@ run_cmake(VsDpiAwareBadParam) run_cmake(VsPrecompileHeaders) run_cmake(VsPrecompileHeadersReuseFromCompilePDBName) +set(RunCMake_GENERATOR_TOOLSET "VCTargetsPath=$(VCTargetsPath)") +run_cmake(VsVCTargetsPath) +unset(RunCMake_GENERATOR_TOOLSET) + if(CMAKE_C_COMPILER_ID STREQUAL "MSVC" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 19.05) run_cmake(VsJustMyCode) endif() diff --git a/Tests/RunCMake/VS10Project/VsCSharpDocumentationFile-check.cmake b/Tests/RunCMake/VS10Project/VsCSharpDocumentationFile-check.cmake new file mode 100644 index 0000000..0393362 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsCSharpDocumentationFile-check.cmake @@ -0,0 +1,26 @@ +# +# Check C# VS project for required elements +# +set(csProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.csproj") +if(NOT EXISTS "${csProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${csProjectFile} does not exist.") + return() +endif() + +file(STRINGS "${csProjectFile}" lines) + +set(HAVE_DocumentationFile 0) +foreach(line IN LISTS lines) + if(line MATCHES "^ *<DocumentationFile>([^<>]+)</DocumentationFile>") + if(HAVE_DocumentationFile) + set(RunCMake_TEST_FAILED "Documentation node has been generated more than once for\n ${csProjectFile}") + return() + endif() + set(HAVE_DocumentationFile 1) + endif() +endforeach() + +if(NOT HAVE_DocumentationFile) + set(RunCMake_TEST_FAILED "Documentation node has not been generated for\n ${csProjectFile}") + return() +endif() diff --git a/Tests/RunCMake/VS10Project/VsCSharpDocumentationFile.cmake b/Tests/RunCMake/VS10Project/VsCSharpDocumentationFile.cmake new file mode 100644 index 0000000..83b6b97 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsCSharpDocumentationFile.cmake @@ -0,0 +1,8 @@ +set(CMAKE_CONFIGURATION_TYPES Debug) +enable_language(CSharp) + +add_library(foo SHARED + foo.cs) + +set_target_properties(foo PROPERTIES + VS_DOTNET_DOCUMENTATION_FILE foo.xml) diff --git a/Tests/RunCMake/VS10Project/VsGlobals-check.cmake b/Tests/RunCMake/VS10Project/VsGlobals-check.cmake index 0e7fd45..6a30099 100644 --- a/Tests/RunCMake/VS10Project/VsGlobals-check.cmake +++ b/Tests/RunCMake/VS10Project/VsGlobals-check.cmake @@ -1,44 +1,65 @@ -set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") -if(NOT EXISTS "${vcProjectFile}") - set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") - return() -endif() +macro(check_project_file projectFile) + if(NOT EXISTS "${projectFile}") + set(RunCMake_TEST_FAILED "Project file ${projectFile} does not exist.") + return() + endif() + + string(REPLACE "${RunCMake_TEST_BINARY_DIR}/" "" projectName ${projectFile}) -set(InsideGlobals FALSE) -set(DefaultLanguageSet FALSE) -set(MinimumVisualStudioVersionSet FALSE) + set(InsideGlobals FALSE) + set(DefaultLanguageSet FALSE) + set(MinimumVisualStudioVersionSet FALSE) + set(TestPropertySet FALSE) -file(STRINGS "${vcProjectFile}" lines) -foreach(line IN LISTS lines) - if(line MATCHES "^ *<PropertyGroup Label=\"Globals\"> *$") - set(InsideGlobals TRUE) - elseif(line MATCHES "^ *<DefaultLanguage>([a-zA-Z\\-]+)</DefaultLanguage> *$") - if("${CMAKE_MATCH_1}" STREQUAL "en-US") - if(InsideGlobals) - message(STATUS "foo.vcxproj has correct DefaultLanguage global property") - set(DefaultLanguageSet TRUE) - else() - message(STATUS "DefaultLanguage is set but not within \"Globals\" property group") + file(STRINGS "${projectFile}" lines) + foreach(line IN LISTS lines) + if(line MATCHES "^ *<PropertyGroup Label=\"Globals\"> *$") + set(InsideGlobals TRUE) + elseif(line MATCHES "^ *<DefaultLanguage>([a-zA-Z\\-]+)</DefaultLanguage> *$") + if("${CMAKE_MATCH_1}" STREQUAL "en-US") + if(InsideGlobals) + message(STATUS "${projectName} has correct DefaultLanguage global property") + set(DefaultLanguageSet TRUE) + else() + message(STATUS "DefaultLanguage is set but not within \"Globals\" property group") + endif() endif() - endif() - elseif(line MATCHES "^ *<MinimumVisualStudioVersion>([0-9\\.]+)</MinimumVisualStudioVersion> *$") - if("${CMAKE_MATCH_1}" STREQUAL "14.0") - if(InsideGlobals) - message(STATUS "foo.vcxproj has correct MinimumVisualStudioVersion global property") - set(MinimumVisualStudioVersionSet TRUE) - else() - message(STATUS "MinimumVisualStudioVersion is set but not within \"Globals\" property group") + elseif(line MATCHES "^ *<MinimumVisualStudioVersion>([0-9\\.]+)</MinimumVisualStudioVersion> *$") + if("${CMAKE_MATCH_1}" STREQUAL "10.0") + if(InsideGlobals) + message(STATUS "${projectName} has correct MinimumVisualStudioVersion global property") + set(MinimumVisualStudioVersionSet TRUE) + else() + message(STATUS "MinimumVisualStudioVersion is set but not within \"Globals\" property group") + endif() + endif() + elseif(line MATCHES "^ *<TestProperty>(.+)</TestProperty> *$") + if("${CMAKE_MATCH_1}" STREQUAL "TestValue") + if(InsideGlobals) + message(STATUS "${projectName} has correct TestProperty global property") + set(TestPropertySet TRUE) + else() + message(STATUS "TestProperty is set but not within \"Globals\" property group") + endif() endif() endif() + endforeach() + + if(NOT DefaultLanguageSet) + set(RunCMake_TEST_FAILED "DefaultLanguage not found or not set correctly in ${projectName}.") + return() + endif() + + if(NOT MinimumVisualStudioVersionSet) + set(RunCMake_TEST_FAILED "MinimumVisualStudioVersion not found or not set correctly in ${projectName}.") + return() endif() -endforeach() -if(NOT DefaultLanguageSet) - set(RunCMake_TEST_FAILED "DefaultLanguageSet not found or not set correctly.") - return() -endif() + if(NOT TestPropertySet) + set(RunCMake_TEST_FAILED "TestProperty not found or not set correctly in ${projectName}.") + return() + endif() +endmacro() -if(NOT MinimumVisualStudioVersionSet) - set(RunCMake_TEST_FAILED "MinimumVisualStudioVersionSet not found or not set correctly.") - return() -endif() +check_project_file("${RunCMake_TEST_BINARY_DIR}/CMakeFiles/${CMAKE_VERSION}/CompilerIdCXX/CompilerIdCXX.vcxproj") +check_project_file("${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") diff --git a/Tests/RunCMake/VS10Project/VsGlobals.cmake b/Tests/RunCMake/VS10Project/VsGlobals.cmake index a3ed5af..09d806d 100644 --- a/Tests/RunCMake/VS10Project/VsGlobals.cmake +++ b/Tests/RunCMake/VS10Project/VsGlobals.cmake @@ -1,8 +1,9 @@ -enable_language(CXX) - set(CMAKE_VS_GLOBALS "DefaultLanguage=en-US" - "MinimumVisualStudioVersion=14.0" + "MinimumVisualStudioVersion=10.0" + "TestProperty=TestValue" ) +enable_language(CXX) + add_library(foo foo.cpp) diff --git a/Tests/RunCMake/VS10Project/VsVCTargetsPath-check.cmake b/Tests/RunCMake/VS10Project/VsVCTargetsPath-check.cmake new file mode 100644 index 0000000..5b1701c --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsVCTargetsPath-check.cmake @@ -0,0 +1,32 @@ +macro(check_project_file projectFile) + set(insideGlobals FALSE) + set(pathFound FALSE) + + if(NOT EXISTS "${projectFile}") + set(RunCMake_TEST_FAILED "Project file ${projectFile} does not exist.") + return() + endif() + + string(REPLACE "${RunCMake_TEST_BINARY_DIR}/" "" projectName ${projectFile}) + + file(STRINGS "${projectFile}" lines) + foreach(line IN LISTS lines) + if(line MATCHES "^ *<PropertyGroup Label=\"Globals\">.*$") + set(insideGlobals TRUE) + elseif(insideGlobals) + if(line MATCHES "^ *</PropertyGroup>.*$") + set(insideGlobals FALSE) + elseif(line MATCHES "^ *<VCTargetsPath>(.+)</VCTargetsPath>*$") + message(STATUS "Found VCTargetsPath = ${CMAKE_MATCH_1} in PropertyGroup 'Globals' in ${projectName}") + set(pathFound TRUE) + endif() + endif() + endforeach() + if(NOT pathFound) + set(RunCMake_TEST_FAILED "VCTargetsPath not found in \"Globals\" propertygroup in ${projectName}") + return() # This should intentionally return from the caller, not the macro + endif() +endmacro() + +check_project_file("${RunCMake_TEST_BINARY_DIR}/CMakeFiles/${CMAKE_VERSION}/CompilerIdCXX/CompilerIdCXX.vcxproj") +check_project_file("${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") diff --git a/Tests/RunCMake/VS10Project/VsVCTargetsPath.cmake b/Tests/RunCMake/VS10Project/VsVCTargetsPath.cmake new file mode 100644 index 0000000..6a6088f --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsVCTargetsPath.cmake @@ -0,0 +1,3 @@ +enable_language(CXX) + +add_library(foo foo.cpp) diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 9e82841..6ecf3f2 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -54,6 +54,20 @@ endfunction() XcodeDependOnZeroCheck() +function(XcodeObjcxxFlags testName) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${testName}-build) + set(RunCMake_TEST_NO_CLEAN 1) + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(${testName}) + run_cmake_command(${testName}-build ${CMAKE_COMMAND} --build .) +endfunction() + +XcodeObjcxxFlags(XcodeObjcFlags) +XcodeObjcxxFlags(XcodeObjcxxFlags) + # Isolate device tests from host architecture selection. unset(ENV{CMAKE_OSX_ARCHITECTURES}) diff --git a/Tests/RunCMake/XcodeProject/XcodeObjcFlags.cmake b/Tests/RunCMake/XcodeProject/XcodeObjcFlags.cmake new file mode 100644 index 0000000..4840276 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeObjcFlags.cmake @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.15) +project(objctest LANGUAGES C OBJC) + +include(CheckOBJCCompilerFlag) +check_objc_compiler_flag(-fobjc-arc HAVE_OBJC_ARC) + +if(HAVE_OBJC_ARC) + add_compile_options(-fobjc-arc) + add_compile_definitions(HAVE_OBJC_ARC) +endif() + +add_library(myfuncs STATIC myfuncs.m) diff --git a/Tests/RunCMake/XcodeProject/XcodeObjcxxFlags.cmake b/Tests/RunCMake/XcodeProject/XcodeObjcxxFlags.cmake new file mode 100644 index 0000000..0ad942f --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeObjcxxFlags.cmake @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.15) +project(objcxxtest LANGUAGES CXX OBJCXX) + +include(CheckOBJCXXCompilerFlag) +check_objcxx_compiler_flag(-fobjc-arc HAVE_OBJC_ARC) + +if(HAVE_OBJC_ARC) + add_compile_options(-fobjc-arc) + add_compile_definitions(HAVE_OBJC_ARC) +endif() + +add_library(myfuncs STATIC myfuncs.mm) diff --git a/Tests/RunCMake/XcodeProject/myfuncs.m b/Tests/RunCMake/XcodeProject/myfuncs.m new file mode 100644 index 0000000..742ba8e --- /dev/null +++ b/Tests/RunCMake/XcodeProject/myfuncs.m @@ -0,0 +1,3 @@ +#if defined(HAVE_OBJC_ARC) && ! __has_feature(objc_arc) +#error THIS CODE MUST BE COMPILED WITH ARC ENABLED! +#endif diff --git a/Tests/RunCMake/XcodeProject/myfuncs.mm b/Tests/RunCMake/XcodeProject/myfuncs.mm new file mode 100644 index 0000000..742ba8e --- /dev/null +++ b/Tests/RunCMake/XcodeProject/myfuncs.mm @@ -0,0 +1,3 @@ +#if defined(HAVE_OBJC_ARC) && ! __has_feature(objc_arc) +#error THIS CODE MUST BE COMPILED WITH ARC ENABLED! +#endif diff --git a/Tests/RunCMake/foreach/RunCMakeTest.cmake b/Tests/RunCMake/foreach/RunCMakeTest.cmake index 4b74cfe..0f1fdd4 100644 --- a/Tests/RunCMake/foreach/RunCMakeTest.cmake +++ b/Tests/RunCMake/foreach/RunCMakeTest.cmake @@ -1,3 +1,4 @@ include(RunCMake) run_cmake(BadRangeInFunction) +run_cmake(foreach-all-test) diff --git a/Tests/RunCMake/foreach/foreach-all-test-stdout.txt b/Tests/RunCMake/foreach/foreach-all-test-stdout.txt new file mode 100644 index 0000000..e8f622d --- /dev/null +++ b/Tests/RunCMake/foreach/foreach-all-test-stdout.txt @@ -0,0 +1,44 @@ +-- foreach\(RANGE\): +-- \[0\.\.1\]/1 +-- < 0 +-- < 1 +-- \[1\.\.1\]/1 +-- < 1 +-- \[0\.\.10\]/2 +-- < 0 +-- < 2 +-- < 4 +-- < 6 +-- < 8 +-- < 10 +-- \[-10\.\.0\]/3 +-- < -10 +-- < -7 +-- < -4 +-- < -1 +-- \[0\.\.-10\]/-5 +-- < 0 +-- < -5 +-- < -10 +-- foreach\(IN ITEMS\): +-- < one +-- < two +-- < three +-- foreach\(IN LISTS\): +-- < satu +-- < dua +-- < tiga +-- foreach\(IN LISTS and ITEMS\): +-- < satu +-- < dua +-- < tiga +-- < one +-- < two +-- < three +-- foreach\(IN ITEMS and LISTS\): +-- < one +-- < two +-- < three +-- < satu +-- < dua +-- < tiga diff --git a/Tests/RunCMake/foreach/foreach-all-test.cmake b/Tests/RunCMake/foreach/foreach-all-test.cmake new file mode 100644 index 0000000..2e377c8 --- /dev/null +++ b/Tests/RunCMake/foreach/foreach-all-test.cmake @@ -0,0 +1,67 @@ +message(STATUS "foreach(RANGE):") +list(APPEND CMAKE_MESSAGE_INDENT " ") + +message(STATUS "[0..1]/1") +list(APPEND CMAKE_MESSAGE_INDENT " < ") +foreach(i RANGE 1) + message(STATUS ${i}) +endforeach() +list(POP_BACK CMAKE_MESSAGE_INDENT) + +message(STATUS "[1..1]/1") +list(APPEND CMAKE_MESSAGE_INDENT " < ") +foreach(i RANGE 1 1) + message(STATUS ${i}) +endforeach() +list(POP_BACK CMAKE_MESSAGE_INDENT) + +message(STATUS "[0..10]/2") +list(APPEND CMAKE_MESSAGE_INDENT " < ") +foreach(i RANGE 0 10 2) + message(STATUS ${i}) +endforeach() +list(POP_BACK CMAKE_MESSAGE_INDENT) + +message(STATUS "[-10..0]/3") +list(APPEND CMAKE_MESSAGE_INDENT " < ") +foreach(i RANGE -10 0 3) + message(STATUS ${i}) +endforeach() +list(POP_BACK CMAKE_MESSAGE_INDENT) + +message(STATUS "[0..-10]/-5") +list(APPEND CMAKE_MESSAGE_INDENT " < ") +foreach(i RANGE 0 -10 -5) + message(STATUS ${i}) +endforeach() +list(POP_BACK CMAKE_MESSAGE_INDENT) +list(POP_BACK CMAKE_MESSAGE_INDENT) + +message(STATUS "foreach(IN ITEMS):") +list(APPEND CMAKE_MESSAGE_INDENT " < ") +foreach(i IN ITEMS one two three) + message(STATUS ${i}) +endforeach() +list(POP_BACK CMAKE_MESSAGE_INDENT) + +message(STATUS "foreach(IN LISTS):") +list(APPEND CMAKE_MESSAGE_INDENT " < ") +list(APPEND count satu dua tiga) +foreach(i IN LISTS count) + message(STATUS ${i}) +endforeach() +list(POP_BACK CMAKE_MESSAGE_INDENT) + +message(STATUS "foreach(IN LISTS and ITEMS):") +list(APPEND CMAKE_MESSAGE_INDENT " < ") +foreach(i IN LISTS count ITEMS one two three) + message(STATUS ${i}) +endforeach() +list(POP_BACK CMAKE_MESSAGE_INDENT) + +message(STATUS "foreach(IN ITEMS and LISTS):") +list(APPEND CMAKE_MESSAGE_INDENT " < ") +foreach(i IN ITEMS one two three LISTS count) + message(STATUS ${i}) +endforeach() +list(POP_BACK CMAKE_MESSAGE_INDENT) diff --git a/Tests/RunCMake/message/RunCMakeTest.cmake b/Tests/RunCMake/message/RunCMakeTest.cmake index 681839d..0313ed1 100644 --- a/Tests/RunCMake/message/RunCMakeTest.cmake +++ b/Tests/RunCMake/message/RunCMakeTest.cmake @@ -65,6 +65,11 @@ foreach(opt IN ITEMS loglevel log-level) endforeach() run_cmake_command( + message-log-level-override + ${CMAKE_COMMAND} --log-level=debug -DCMAKE_MESSAGE_LOG_LEVEL=TRACE -P ${RunCMake_SOURCE_DIR}/message-all-loglevels.cmake + ) + +run_cmake_command( message-indent ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/message-indent.cmake ) @@ -72,3 +77,23 @@ run_cmake_command( message-indent-multiline ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/message-indent-multiline.cmake ) + +run_cmake_command( + message-context-cli + ${CMAKE_COMMAND} --log-level=trace --log-context -P ${RunCMake_SOURCE_DIR}/message-context.cmake + ) + +run_cmake_command( + message-context-cache + ${CMAKE_COMMAND} -DCMAKE_MESSAGE_LOG_LEVEL=TRACE -DCMAKE_MESSAGE_CONTEXT_SHOW=ON -P ${RunCMake_SOURCE_DIR}/message-context.cmake + ) + +run_cmake_command( + message-context-cli-wins-cache + ${CMAKE_COMMAND} --log-level=verbose --log-context -DCMAKE_MESSAGE_CONTEXT_SHOW=OFF -P ${RunCMake_SOURCE_DIR}/message-context.cmake + ) + +run_cmake_command( + message-checks + ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/message-checks.cmake + ) diff --git a/Tests/RunCMake/message/message-checks-stderr.txt b/Tests/RunCMake/message/message-checks-stderr.txt new file mode 100644 index 0000000..fdacdb2 --- /dev/null +++ b/Tests/RunCMake/message/message-checks-stderr.txt @@ -0,0 +1,3 @@ +^CMake Warning \(dev\) at.*/Tests/RunCMake/message/message-checks.cmake:13 \(message\): + Ignored CHECK_FAIL without CHECK_START +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/message/message-checks-stdout.txt b/Tests/RunCMake/message/message-checks-stdout.txt new file mode 100644 index 0000000..4f5f2ef --- /dev/null +++ b/Tests/RunCMake/message/message-checks-stdout.txt @@ -0,0 +1,10 @@ +-- Find `libfoo` +-- Looking for `libfoo\.h` +-- Looking for `libfoo\.h` - found \[/usr/include\] +-- Looking for `libfoo\.so` +-- Looking for `libfoo\.so` - found \[/usr/lib/libfoo\.so\] +-- Getting `libfoo` version +-- Looking for `libfoo/version\.h` +-- Looking for `libfoo/version\.h` - found +-- Getting `libfoo` version - 1\.2\.3 +-- Find `libfoo` - required version 4\.5\.6 but found 1\.2\.3 diff --git a/Tests/RunCMake/message/message-checks.cmake b/Tests/RunCMake/message/message-checks.cmake new file mode 100644 index 0000000..605846e --- /dev/null +++ b/Tests/RunCMake/message/message-checks.cmake @@ -0,0 +1,13 @@ +message(CHECK_START "Find `libfoo`") +message(CHECK_START "Looking for `libfoo.h`") +message(CHECK_PASS "found [/usr/include]") +message(CHECK_START "Looking for `libfoo.so`") +message(CHECK_PASS "found [/usr/lib/libfoo.so]") +message(CHECK_START "Getting `libfoo` version") +message(CHECK_START "Looking for `libfoo/version.h`") +message(CHECK_PASS "found") +message(CHECK_PASS "1.2.3") +message(CHECK_FAIL "required version 4.5.6 but found 1.2.3") + +# Should generate an error, no associated CHECK_START +message(CHECK_FAIL "unmatched check fail case") diff --git a/Tests/RunCMake/message/message-context-cache-stdout.txt b/Tests/RunCMake/message/message-context-cache-stdout.txt new file mode 100644 index 0000000..af18c15 --- /dev/null +++ b/Tests/RunCMake/message/message-context-cache-stdout.txt @@ -0,0 +1,8 @@ +-- Begin context output test +-- \[top\] Top: before +-- \[top\.foo\.bar\] <-- indent -->bar VERBOSE message +-- \[top\.foo\] foo TRACE message +-- \[top\.foo\.baz\] This is the multi-line +\[top\.foo\.baz\] baz DEBUG message +-- \[top\] Top: after +-- End of context output test diff --git a/Tests/RunCMake/message/message-context-cli-stdout.txt b/Tests/RunCMake/message/message-context-cli-stdout.txt new file mode 100644 index 0000000..af18c15 --- /dev/null +++ b/Tests/RunCMake/message/message-context-cli-stdout.txt @@ -0,0 +1,8 @@ +-- Begin context output test +-- \[top\] Top: before +-- \[top\.foo\.bar\] <-- indent -->bar VERBOSE message +-- \[top\.foo\] foo TRACE message +-- \[top\.foo\.baz\] This is the multi-line +\[top\.foo\.baz\] baz DEBUG message +-- \[top\] Top: after +-- End of context output test diff --git a/Tests/RunCMake/message/message-context-cli-wins-cache-stdout.txt b/Tests/RunCMake/message/message-context-cli-wins-cache-stdout.txt new file mode 100644 index 0000000..157db97 --- /dev/null +++ b/Tests/RunCMake/message/message-context-cli-wins-cache-stdout.txt @@ -0,0 +1,5 @@ +-- Begin context output test +-- \[top\] Top: before +-- \[top\.foo\.bar\] <-- indent -->bar VERBOSE message +-- \[top\] Top: after +-- End of context output test diff --git a/Tests/RunCMake/message/message-context.cmake b/Tests/RunCMake/message/message-context.cmake new file mode 100644 index 0000000..93d4cd9 --- /dev/null +++ b/Tests/RunCMake/message/message-context.cmake @@ -0,0 +1,27 @@ +function(bar) + list(APPEND CMAKE_MESSAGE_CONTEXT "bar") + list(APPEND CMAKE_MESSAGE_INDENT "<-- indent -->") + message(VERBOSE "bar VERBOSE message") +endfunction() + +function(baz) + list(APPEND CMAKE_MESSAGE_CONTEXT "baz") + message(DEBUG "This is the multi-line\nbaz DEBUG message") +endfunction() + +function(foo) + list(APPEND CMAKE_MESSAGE_CONTEXT "foo") + bar() + message(TRACE "foo TRACE message") + baz() +endfunction() + +message(STATUS "Begin context output test") +list(APPEND CMAKE_MESSAGE_CONTEXT "top") + +message(STATUS "Top: before") +foo() +message(STATUS "Top: after") + +list(POP_BACK CMAKE_MESSAGE_CONTEXT) +message(STATUS "End of context output test") diff --git a/Tests/RunCMake/message/message-log-level-debug-stdout.txt b/Tests/RunCMake/message/message-log-level-debug-stdout.txt index 1452137..feee110 100644 --- a/Tests/RunCMake/message/message-log-level-debug-stdout.txt +++ b/Tests/RunCMake/message/message-log-level-debug-stdout.txt @@ -1,3 +1,3 @@ -- STATUS message -- VERBOSE message --- DEBUG message +-- DEBUG message$ diff --git a/Tests/RunCMake/message/message-log-level-default-stdout.txt b/Tests/RunCMake/message/message-log-level-default-stdout.txt index 809f4cc..b5d6acb 100644 --- a/Tests/RunCMake/message/message-log-level-default-stdout.txt +++ b/Tests/RunCMake/message/message-log-level-default-stdout.txt @@ -1 +1 @@ --- STATUS message +-- STATUS message$ diff --git a/Tests/RunCMake/message/message-log-level-override-stderr.txt b/Tests/RunCMake/message/message-log-level-override-stderr.txt new file mode 100644 index 0000000..efec736 --- /dev/null +++ b/Tests/RunCMake/message/message-log-level-override-stderr.txt @@ -0,0 +1,12 @@ +^CMake Deprecation Warning at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:2 \(message\): + Deprecation warning ++ +CMake Warning \(dev\) at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:3 \(message\): + Author warning message +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +CMake Warning at.*/Tests/RunCMake/message/message-all-loglevels\.cmake:4 \(message\): + Warning message ++ +Default NOTICE message +NOTICE message$ diff --git a/Tests/RunCMake/message/message-log-level-override-stdout.txt b/Tests/RunCMake/message/message-log-level-override-stdout.txt new file mode 100644 index 0000000..feee110 --- /dev/null +++ b/Tests/RunCMake/message/message-log-level-override-stdout.txt @@ -0,0 +1,3 @@ +-- STATUS message +-- VERBOSE message +-- DEBUG message$ diff --git a/Tests/RunCMake/message/message-log-level-status-stdout.txt b/Tests/RunCMake/message/message-log-level-status-stdout.txt index 809f4cc..b5d6acb 100644 --- a/Tests/RunCMake/message/message-log-level-status-stdout.txt +++ b/Tests/RunCMake/message/message-log-level-status-stdout.txt @@ -1 +1 @@ --- STATUS message +-- STATUS message$ diff --git a/Tests/RunCMake/message/message-log-level-trace-stdout.txt b/Tests/RunCMake/message/message-log-level-trace-stdout.txt index 1cfce6f..3d36a7f 100644 --- a/Tests/RunCMake/message/message-log-level-trace-stdout.txt +++ b/Tests/RunCMake/message/message-log-level-trace-stdout.txt @@ -1,4 +1,4 @@ -- STATUS message -- VERBOSE message -- DEBUG message --- TRACE message +-- TRACE message$ diff --git a/Tests/RunCMake/message/message-log-level-verbose-stdout.txt b/Tests/RunCMake/message/message-log-level-verbose-stdout.txt index c15d43f..47c0846 100644 --- a/Tests/RunCMake/message/message-log-level-verbose-stdout.txt +++ b/Tests/RunCMake/message/message-log-level-verbose-stdout.txt @@ -1,2 +1,2 @@ -- STATUS message --- VERBOSE message +-- VERBOSE message$ diff --git a/Tests/RunCMake/message/message-loglevel-debug-stdout.txt b/Tests/RunCMake/message/message-loglevel-debug-stdout.txt index 1452137..feee110 100644 --- a/Tests/RunCMake/message/message-loglevel-debug-stdout.txt +++ b/Tests/RunCMake/message/message-loglevel-debug-stdout.txt @@ -1,3 +1,3 @@ -- STATUS message -- VERBOSE message --- DEBUG message +-- DEBUG message$ diff --git a/Tests/RunCMake/message/message-loglevel-default-stdout.txt b/Tests/RunCMake/message/message-loglevel-default-stdout.txt index 809f4cc..b5d6acb 100644 --- a/Tests/RunCMake/message/message-loglevel-default-stdout.txt +++ b/Tests/RunCMake/message/message-loglevel-default-stdout.txt @@ -1 +1 @@ --- STATUS message +-- STATUS message$ diff --git a/Tests/RunCMake/message/message-loglevel-status-stdout.txt b/Tests/RunCMake/message/message-loglevel-status-stdout.txt index 809f4cc..b5d6acb 100644 --- a/Tests/RunCMake/message/message-loglevel-status-stdout.txt +++ b/Tests/RunCMake/message/message-loglevel-status-stdout.txt @@ -1 +1 @@ --- STATUS message +-- STATUS message$ diff --git a/Tests/RunCMake/message/message-loglevel-trace-stdout.txt b/Tests/RunCMake/message/message-loglevel-trace-stdout.txt index 1cfce6f..3d36a7f 100644 --- a/Tests/RunCMake/message/message-loglevel-trace-stdout.txt +++ b/Tests/RunCMake/message/message-loglevel-trace-stdout.txt @@ -1,4 +1,4 @@ -- STATUS message -- VERBOSE message -- DEBUG message --- TRACE message +-- TRACE message$ diff --git a/Tests/RunCMake/message/message-loglevel-verbose-stdout.txt b/Tests/RunCMake/message/message-loglevel-verbose-stdout.txt index c15d43f..47c0846 100644 --- a/Tests/RunCMake/message/message-loglevel-verbose-stdout.txt +++ b/Tests/RunCMake/message/message-loglevel-verbose-stdout.txt @@ -1,2 +1,2 @@ -- STATUS message --- VERBOSE message +-- VERBOSE message$ diff --git a/Tests/RunCMake/try_compile/ObjCStandard-result.txt b/Tests/RunCMake/try_compile/ObjCStandard-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/ObjCStandard-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/ObjCStandard-stderr.txt b/Tests/RunCMake/try_compile/ObjCStandard-stderr.txt new file mode 100644 index 0000000..f1b4df9 --- /dev/null +++ b/Tests/RunCMake/try_compile/ObjCStandard-stderr.txt @@ -0,0 +1,7 @@ +^CMake Error at .*/Tests/RunCMake/try_compile/ObjCStandard-build/CMakeFiles/CMakeTmp/CMakeLists.txt:[0-9]+ \(add_executable\): + OBJC_STANDARD is set to invalid value '3' ++ +CMake Error at ObjCStandard.cmake:[0-9]+ \(try_compile\): + Failed to generate test project build system. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/try_compile/ObjCStandard.cmake b/Tests/RunCMake/try_compile/ObjCStandard.cmake new file mode 100644 index 0000000..b2066f9 --- /dev/null +++ b/Tests/RunCMake/try_compile/ObjCStandard.cmake @@ -0,0 +1,7 @@ +enable_language(OBJC) +try_compile(result ${CMAKE_CURRENT_BINARY_DIR} + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.m + OBJC_STANDARD 3 + OUTPUT_VARIABLE out + ) +message("try_compile output:\n${out}") diff --git a/Tests/RunCMake/try_compile/ObjCxxStandard-result.txt b/Tests/RunCMake/try_compile/ObjCxxStandard-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/ObjCxxStandard-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/ObjCxxStandard-stderr.txt b/Tests/RunCMake/try_compile/ObjCxxStandard-stderr.txt new file mode 100644 index 0000000..a2f91b4 --- /dev/null +++ b/Tests/RunCMake/try_compile/ObjCxxStandard-stderr.txt @@ -0,0 +1,7 @@ +^CMake Error at .*/Tests/RunCMake/try_compile/ObjCxxStandard-build/CMakeFiles/CMakeTmp/CMakeLists.txt:[0-9]+ \(add_executable\): + OBJCXX_STANDARD is set to invalid value '3' ++ +CMake Error at ObjCxxStandard.cmake:[0-9]+ \(try_compile\): + Failed to generate test project build system. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/try_compile/ObjCxxStandard.cmake b/Tests/RunCMake/try_compile/ObjCxxStandard.cmake new file mode 100644 index 0000000..1221805 --- /dev/null +++ b/Tests/RunCMake/try_compile/ObjCxxStandard.cmake @@ -0,0 +1,7 @@ +enable_language(OBJCXX) +try_compile(result ${CMAKE_CURRENT_BINARY_DIR} + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.mm + OBJCXX_STANDARD 3 + OUTPUT_VARIABLE out + ) +message("try_compile output:\n${out}") diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake index 77fb7a0..91f014e 100644 --- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake +++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake @@ -37,11 +37,17 @@ if(CMAKE_C_STANDARD_DEFAULT) elseif(DEFINED CMAKE_C_STANDARD_DEFAULT) run_cmake(CStandardNoDefault) endif() +if(CMAKE_OBJC_STANDARD_DEFAULT) + run_cmake(ObjCStandard) +endif() if(CMAKE_CXX_STANDARD_DEFAULT) run_cmake(CxxStandard) elseif(DEFINED CMAKE_CXX_STANDARD_DEFAULT) run_cmake(CxxStandardNoDefault) endif() +if(CMAKE_OBJCXX_STANDARD_DEFAULT) + run_cmake(ObjCxxStandard) +endif() if(CMake_TEST_CUDA) if(CMAKE_HOST_WIN32) run_cmake(CudaStandardNoDefault) diff --git a/Tests/RunCMake/try_compile/src.m b/Tests/RunCMake/try_compile/src.m new file mode 100644 index 0000000..f8b643a --- /dev/null +++ b/Tests/RunCMake/try_compile/src.m @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/Tests/RunCMake/try_compile/src.mm b/Tests/RunCMake/try_compile/src.mm new file mode 100644 index 0000000..f8b643a --- /dev/null +++ b/Tests/RunCMake/try_compile/src.mm @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt index 498e556..9ec9b70 100644 --- a/Tests/TryCompile/CMakeLists.txt +++ b/Tests/TryCompile/CMakeLists.txt @@ -365,6 +365,25 @@ if (APPLE) TEST_ASSERT(SIMPLE_OBJCXX_RUN_SHOULD_WORK "CHECK_OBJCXX_SOURCE_RUNS() failed, but should have succeeded") TEST_FAIL(OBJCXX_RUN_SHOULD_FAIL "CHECK_OBJCXX_SOURCE_RUNS() succeeds, but should have failed") TEST_ASSERT(OBJCXX_RUN_SHOULD_WORK "CHECK_OBJCXX_SOURCE_RUNS() failed, but should have succeeded") + + # try to compile a file that should compile + try_compile(SHOULD_PASS + ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp + ${TryCompile_SOURCE_DIR}/pass.m + OUTPUT_VARIABLE TRY_OUT) + if(NOT SHOULD_PASS) + message(SEND_ERROR "should pass failed ${TRY_OUT}") + endif() + + # try to compile a file that should not compile + try_compile(SHOULD_FAIL + ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp + ${TryCompile_SOURCE_DIR}/fail.m + OUTPUT_VARIABLE TRY_OUT) + if(SHOULD_FAIL) + message(SEND_ERROR "Should fail passed ${TRY_OUT}") + endif() + endif() ####################################################################### diff --git a/Tests/TryCompile/fail.m b/Tests/TryCompile/fail.m new file mode 100644 index 0000000..b915ebe --- /dev/null +++ b/Tests/TryCompile/fail.m @@ -0,0 +1 @@ +asdflkjasdlj diff --git a/Tests/TryCompile/pass.m b/Tests/TryCompile/pass.m new file mode 100644 index 0000000..f8b643a --- /dev/null +++ b/Tests/TryCompile/pass.m @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} |