diff options
Diffstat (limited to 'Tests')
184 files changed, 1031 insertions, 240 deletions
diff --git a/Tests/AliasTarget/CMakeLists.txt b/Tests/AliasTarget/CMakeLists.txt index e1d8966..47ccbdc 100644 --- a/Tests/AliasTarget/CMakeLists.txt +++ b/Tests/AliasTarget/CMakeLists.txt @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION 2.8.11) +cmake_policy(SET CMP0054 NEW) project(AliasTarget) set(CMAKE_CXX_STANDARD 98) @@ -10,6 +11,12 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL HP AND set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -AA") endif () +# Clang/C2 in C++98 mode cannot properly handle some of MSVC headers +if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND + CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") + set(CMAKE_CXX_STANDARD 11) +endif() + add_library(foo SHARED empty.cpp) add_library(PREFIX::Foo ALIAS foo) add_library(Another::Alias ALIAS foo) diff --git a/Tests/AliasTarget/subdir/CMakeLists.txt b/Tests/AliasTarget/subdir/CMakeLists.txt index 8c84aea..05a7d86 100644 --- a/Tests/AliasTarget/subdir/CMakeLists.txt +++ b/Tests/AliasTarget/subdir/CMakeLists.txt @@ -1,3 +1,8 @@ add_library(tgt STATIC empty.cpp) add_library(Sub::tgt ALIAS tgt) + +# foo comes from the top-level CMakeLists.txt +add_library(Top::foo ALIAS foo) +get_target_property(some_prop Top::foo SOME_PROP) +target_link_libraries(tgt Top::foo) diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt index 36987de..9b48b14 100644 --- a/Tests/BuildDepends/CMakeLists.txt +++ b/Tests/BuildDepends/CMakeLists.txt @@ -42,7 +42,7 @@ list(APPEND _cmake_options "-DTEST_LINK_DEPENDS=${TEST_LINK_DEPENDS}") list(APPEND _cmake_options "-DCMAKE_FORCE_DEPFILES=1") -if(NOT CMAKE_GENERATOR MATCHES "Visual Studio ([^6789]|[6789][0-9])") +if(NOT CMAKE_GENERATOR MATCHES "Visual Studio ([^789]|[789][0-9])") set(TEST_MULTI3 1) list(APPEND _cmake_options "-DTEST_MULTI3=1") endif() @@ -304,9 +304,6 @@ message("Run result: ${runResult} Output: \"${out}\"") if("${out}" STREQUAL "HEADER_STRING: ninja changed ") message("Worked!") -elseif(CMAKE_GENERATOR STREQUAL "Visual Studio 6") - # Tolerate failure because VS 6 does not seem to recompile ninjadep.cpp - # when the "dir/header.h" it includes changes. else() message(SEND_ERROR "Project did not rebuild properly. Output[${out}]\n" " expected [HEADER_STRING: ninja changed]") diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 7bb0721..8a256bf 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -624,8 +624,8 @@ if(BUILD_TESTING) endif() # test for correct sub-project generation - # not implemented in VS 6, VS 7.0, Xcode, or Ninja - if(NOT CMAKE_GENERATOR MATCHES "Visual Studio [67]$|Xcode|Ninja") + # not implemented in VS 7.0, Xcode, or Ninja + if(NOT CMAKE_GENERATOR MATCHES "Visual Studio 7$|Xcode|Ninja") # run cmake and configure all of SubProject # but only build the independent executable car add_test(SubProject ${CMAKE_CTEST_COMMAND} @@ -684,14 +684,17 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release endif() endmacro() if(CMAKE_BUILD_NIGHTLY_RELEASES) - ADD_NIGHTLY_BUILD_TEST(CMakeNightlyWindows - dash3win7_release.cmake) + ADD_NIGHTLY_BUILD_TEST(CMakeNightlyWin32 + win32_release.cmake) + ADD_NIGHTLY_BUILD_TEST(CMakeNightlyWin64 + win64_release.cmake) ADD_NIGHTLY_BUILD_TEST(CMakeNightlyOSX - dashmacmini5_release.cmake) + osx_release.cmake) ADD_NIGHTLY_BUILD_TEST(CMakeNightlyLinux32 - magrathea_release.cmake) + linux32_release.cmake) ADD_NIGHTLY_BUILD_TEST(CMakeNightlyLinux64 linux64_release.cmake) + set_property(TEST CMakeNightlyWin64 PROPERTY DEPENDS CMakeNightlyWin32) endif() # add tests with more complex invocations @@ -1371,6 +1374,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(FindJsonCpp) endif() + if(CMake_TEST_FindLTTngUST) + add_subdirectory(FindLTTngUST) + endif() + if(CMake_TEST_FindOpenSSL) add_subdirectory(FindOpenSSL) endif() @@ -1644,7 +1651,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release if(CMake_TEST_XCODE_VERSION AND NOT CMake_TEST_XCODE_VERSION VERSION_LESS 5 AND OSX_VERSION MATCHES "^([0-9]+\\.[0-9]+)") - set(XCTest_BUILD_OPTIONS -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_MATCH_1}) + set(XCTest_BUILD_OPTIONS -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_MATCH_1} -DCMAKE_OSX_SYSROOT=macosx) ADD_TEST_MACRO(XCTest ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> -V) endif() @@ -1740,7 +1747,9 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release if(MSVC) ADD_TEST_MACRO(ForceInclude foo) ADD_TEST_MACRO(PDBDirectoryAndName myexe) - ADD_TEST_MACRO(PrecompiledHeader foo) + if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang") + ADD_TEST_MACRO(PrecompiledHeader foo) + endif() endif() if(MSVC OR "${CMAKE_GENERATOR}" MATCHES "(MSYS|MinGW) Makefiles") @@ -1869,7 +1878,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release endif() if(MSVC AND NOT MSVC_VERSION LESS 1310 - AND NOT CMAKE_GENERATOR MATCHES "Visual Studio [67]( |$)" + AND NOT CMAKE_GENERATOR MATCHES "Visual Studio 7( |$)" AND (NOT CMAKE_GENERATOR MATCHES "Visual Studio [89]( |$)" OR CMAKE_SIZEOF_VOID_P EQUAL 4) ) @@ -1881,7 +1890,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ADD_TEST_MACRO(SBCS SBCS) endif() - if(NOT "${CMAKE_GENERATOR}" MATCHES "Visual Studio [6789]( |$)" + if(NOT "${CMAKE_GENERATOR}" MATCHES "Visual Studio [789]( |$)" AND NOT CMAKE_GENERATOR_TOOLSET) ADD_TEST_MACRO(VSWindowsFormsResx VSWindowsFormsResx) endif() @@ -1910,7 +1919,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release if(CMake_TEST_DEVENV) # The test (and tested property) works with .sln files, so it's skipped when: - # * Using VS6, which doesn't use .sln files # * cmake --build is set up to use MSBuild, since the MSBuild invocation does not use the .sln file set(_last_test "") foreach(config ${CMAKE_CONFIGURATION_TYPES}) diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt index bdc2563..8f842d6 100644 --- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt +++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt @@ -81,13 +81,13 @@ endmacro() # reported. foreach(VTEST ALSA ARMADILLO BZIP2 CUPS CURL EXPAT FREETYPE GETTEXT GIT HG - HSPELL ICOTOOL JASPER LIBLZMA LIBXML2 LIBXSLT PERL PKG_CONFIG + HSPELL ICOTOOL JASPER LIBLZMA LIBXML2 LIBXSLT LTTNGUST PERL PKG_CONFIG PostgreSQL TIFF ZLIB) check_version_string(${VTEST} ${VTEST}_VERSION_STRING) endforeach() foreach(VTEST BISON Boost CUDA DOXYGEN FLEX GIF GTK2 - HDF5 LibArchive OPENSCENEGRAPH RUBY SWIG) + HDF5 LibArchive OPENSCENEGRAPH RUBY SWIG Protobuf) check_version_string(${VTEST} ${VTEST}_VERSION) endforeach() diff --git a/Tests/CMakeTests/PushCheckStateTest.cmake.in b/Tests/CMakeTests/PushCheckStateTest.cmake.in index e707b9a..b4c48f4 100644 --- a/Tests/CMakeTests/PushCheckStateTest.cmake.in +++ b/Tests/CMakeTests/PushCheckStateTest.cmake.in @@ -1,29 +1,68 @@ include(CMakePushCheckState) +set(CMAKE_EXTRA_INCLUDE_FILES file1) +set(CMAKE_REQUIRED_INCLUDES dir1) set(CMAKE_REQUIRED_DEFINITIONS defs1 ) +set(CMAKE_REQUIRED_LIBRARIES lib1) +set(CMAKE_REQUIRED_FLAGS flag1) +set(CMAKE_REQUIRED_QUIET 1) cmake_push_check_state() +set(CMAKE_EXTRA_INCLUDE_FILES file2) +set(CMAKE_REQUIRED_INCLUDES dir2) set(CMAKE_REQUIRED_DEFINITIONS defs2) +set(CMAKE_REQUIRED_LIBRARIES lib2) +set(CMAKE_REQUIRED_FLAGS flag2) +set(CMAKE_REQUIRED_QUIET 2) cmake_push_check_state() +set(CMAKE_EXTRA_INCLUDE_FILES file3) set(CMAKE_REQUIRED_DEFINITIONS defs3) +set(CMAKE_REQUIRED_INCLUDES dir3) +set(CMAKE_REQUIRED_DEFINITIONS defs3) +set(CMAKE_REQUIRED_LIBRARIES lib3) +set(CMAKE_REQUIRED_FLAGS flag3) +set(CMAKE_REQUIRED_QUIET 3) cmake_pop_check_state() -if (NOT "${CMAKE_REQUIRED_DEFINITIONS}" STREQUAL "defs2") - set(fatal TRUE) - message("ERROR: "CMAKE_REQUIRED_DEFINITIONS is \"${CMAKE_REQUIRED_DEFINITIONS}\" (expected \"defs2\")" ) -endif() +foreach(pair IN ITEMS + EXTRA_INCLUDE_FILES|file2 + REQUIRED_INCLUDES|dir2 + REQUIRED_DEFINITIONS|defs2 + REQUIRED_LIBRARIES|lib2 + REQUIRED_FLAGS|flag2 + REQUIRED_QUIET|2 + ) + string(REPLACE "|" ";" pair "${pair}") + list(GET pair 0 var) + list(GET pair 1 expected) + if (NOT "${CMAKE_${var}}" STREQUAL "${expected}") + set(fatal TRUE) + message("ERROR: CMAKE_${var} is \"${CMAKE_${var}}\" (expected \"${expected}\")" ) + endif() +endforeach() cmake_pop_check_state() -if (NOT "${CMAKE_REQUIRED_DEFINITIONS}" STREQUAL "defs1") - set(fatal TRUE) - message("ERROR: "CMAKE_REQUIRED_DEFINITIONS is \"${CMAKE_REQUIRED_DEFINITIONS}\" (expected \"defs1\")" ) -endif() - +foreach(pair IN ITEMS + EXTRA_INCLUDE_FILES|file1 + REQUIRED_INCLUDES|dir1 + REQUIRED_DEFINITIONS|defs1 + REQUIRED_LIBRARIES|lib1 + REQUIRED_FLAGS|flag1 + REQUIRED_QUIET|1 + ) + string(REPLACE "|" ";" pair "${pair}") + list(GET pair 0 var) + list(GET pair 1 expected) + if (NOT "${CMAKE_${var}}" STREQUAL "${expected}") + set(fatal TRUE) + message("ERROR: CMAKE_${var} is \"${CMAKE_${var}}\" (expected \"${expected}\")" ) + endif() +endforeach() if(fatal) message(FATAL_ERROR "cmake_push_check_state() test failed") diff --git a/Tests/CMakeTests/String-TIMESTAMP-UnixTime.cmake b/Tests/CMakeTests/String-TIMESTAMP-UnixTime.cmake new file mode 100644 index 0000000..a93e7f5 --- /dev/null +++ b/Tests/CMakeTests/String-TIMESTAMP-UnixTime.cmake @@ -0,0 +1,22 @@ +string(TIMESTAMP timestamp "[%Y-%m-%d %H:%M:%S] %s" UTC) + +string(TIMESTAMP unix_time "%s") + +string(TIMESTAMP year "%Y" UTC) +string(TIMESTAMP days "%j" UTC) + +# Doing proper date calculations here to verify unix timestamps +# could be error prone. +# At the very least use some safe lower and upper bounds to +# see if we are somewhere in the right region. + +math(EXPR years_since_epoch "${year} - 1970") +math(EXPR lower_bound "((${years_since_epoch} * 365) + ${days}) * 86400") +math(EXPR upper_bound "((${years_since_epoch} * 366) + ${days}) * 86400") + + +if(unix_time GREATER lower_bound AND unix_time LESS upper_bound) + message("~${unix_time}~") +else() + message(FATAL_ERROR "${timestamp} unix time not in expected range [${lower_bound}, ${upper_bound}]") +endif() diff --git a/Tests/CMakeTests/StringTest.cmake.in b/Tests/CMakeTests/StringTest.cmake.in index 92e70c3..aba35fe 100644 --- a/Tests/CMakeTests/StringTest.cmake.in +++ b/Tests/CMakeTests/StringTest.cmake.in @@ -36,6 +36,8 @@ set(TIMESTAMP-IncompleteSpecifier-RESULT 0) set(TIMESTAMP-IncompleteSpecifier-STDERR "~foobar%~") set(TIMESTAMP-AllSpecifiers-RESULT 0) set(TIMESTAMP-AllSpecifiers-STDERR "~[0-9]+(;[0-9]+)*~") +set(TIMESTAMP-UnixTime-RESULT 0) +set(TIMESTAMP-UnixTime-STDERR "~[1-9][0-9]+~") include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake") check_cmake_test(String @@ -58,6 +60,7 @@ check_cmake_test(String TIMESTAMP-UnknownSpecifier TIMESTAMP-IncompleteSpecifier TIMESTAMP-AllSpecifiers + TIMESTAMP-UnixTime ) # Execute each test listed in StringTestScript.cmake: @@ -68,9 +71,12 @@ set(number_of_tests_expected 70) include("@CMAKE_CURRENT_SOURCE_DIR@/ExecuteScriptTests.cmake") execute_all_script_tests(${scriptname} number_of_tests_executed) +string(TIMESTAMP timestamp "[%Y-%m-%d %H:%M:%S] UTC %s" UTC) + # And verify that number_of_tests_executed is at least as many as we know # about as of this writing... # +message(STATUS "timestamp='${timestamp}'") message(STATUS "scriptname='${scriptname}'") message(STATUS "number_of_tests_executed='${number_of_tests_executed}'") message(STATUS "number_of_tests_expected='${number_of_tests_expected}'") diff --git a/Tests/CPackComponentsForAll/CMakeLists.txt b/Tests/CPackComponentsForAll/CMakeLists.txt index 823f6db..05c13a4 100644 --- a/Tests/CPackComponentsForAll/CMakeLists.txt +++ b/Tests/CPackComponentsForAll/CMakeLists.txt @@ -92,6 +92,9 @@ if("${CPACK_GENERATOR}" MATCHES "RPM") # test symbolic link to location outside package execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ./outside_package symlink_outside_package) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_outside_package DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) + # test symbolic link to location outside wdr (packaging directory) + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink /outside_package_wdr symlink_outside_wdr) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_outside_wdr DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) endif() # CPack boilerplate for this project diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in index ac9b552..0ffe44d 100644 --- a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in +++ b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in @@ -14,24 +14,38 @@ if(CPACK_GENERATOR MATCHES "RPM") set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/foo/bar") # test requires - set(CPACK_RPM_applications_PACKAGE_REQUIRES "mylib-libraries") + set(CPACK_RPM_APPLICATIONS_PACKAGE_REQUIRES "mylib-libraries") # test a "noarch" rpm - set(CPACK_RPM_headers_PACKAGE_ARCHITECTURE "noarch") + set(CPACK_RPM_HEADERS_PACKAGE_ARCHITECTURE "noarch") # test cross-built rpm - set(CPACK_RPM_applications_PACKAGE_ARCHITECTURE "armv7hf") + set(CPACK_RPM_APPLICATIONS_PACKAGE_ARCHITECTURE "armv7hf") # test package summary override - headers rpm is generated in the middle set(CPACK_RPM_PACKAGE_SUMMARY "default summary") - set(CPACK_RPM_headers_PACKAGE_SUMMARY "headers summary") + set(CPACK_RPM_HEADERS_PACKAGE_SUMMARY "headers summary") # test package description override - headers rpm is generated in the middle - set(CPACK_RPM_headers_PACKAGE_DESCRIPTION "headers description") + set(CPACK_RPM_HEADERS_PACKAGE_DESCRIPTION "headers description") # test package do not use CPACK_PACKAGING_INSTALL_PREFIX # as relocation path - set(CPACK_RPM_NO_libraries_INSTALL_PREFIX_RELOCATION true) + set(CPACK_RPM_NO_LIBRARIES_INSTALL_PREFIX_RELOCATION true) + + # test default permissions + set(CPACK_RPM_DEFAULT_USER defusr) + set(CPACK_RPM_DEFAULT_GROUP defgrp) + set(CPACK_RPM_DEFAULT_FILE_PERMISSIONS + OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ WORLD_READ) + set(CPACK_RPM_DEFAULT_DIR_PERMISSIONS + OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ WORLD_READ) + set(CPACK_RPM_LIBRARIES_DEFAULT_USER user) + set(CPACK_RPM_APPLICATIONS_DEFAULT_GROUP group) + set(CPACK_RPM_LIBRARIES_DEFAULT_FILE_PERMISSIONS + OWNER_READ OWNER_WRITE OWNER_EXECUTE) + set(CPACK_RPM_APPLICATIONS_DEFAULT_DIR_PERMISSIONS + OWNER_READ GROUP_READ WORLD_READ) endif() if(CPACK_GENERATOR MATCHES "DEB") diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-OnePackPerGroup.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig-OnePackPerGroup.cmake.in index 60bdd06..ac65dc9 100644 --- a/Tests/CPackComponentsForAll/MyLibCPackConfig-OnePackPerGroup.cmake.in +++ b/Tests/CPackComponentsForAll/MyLibCPackConfig-OnePackPerGroup.cmake.in @@ -7,7 +7,7 @@ endif() if(CPACK_GENERATOR MATCHES "RPM") set(CPACK_RPM_COMPONENT_INSTALL "ON") - set(CPACK_RPM_Development_PACKAGE_REQUIRES "mylib-Runtime") + set(CPACK_RPM_DEVELOPMENT_PACKAGE_REQUIRES "mylib-Runtime") endif() if(CPACK_GENERATOR MATCHES "DEB") diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index d94a477..e956f17 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -136,8 +136,8 @@ if(CPackGen MATCHES "RPM") endif() set(CPACK_RPM_PACKAGE_SUMMARY "default summary") - set(CPACK_RPM_headers_PACKAGE_SUMMARY "headers summary") - set(CPACK_RPM_headers_PACKAGE_DESCRIPTION "headers description") + set(CPACK_RPM_HEADERS_PACKAGE_SUMMARY "headers summary") + set(CPACK_RPM_HEADERS_PACKAGE_DESCRIPTION "headers description") set(CPACK_COMPONENT_APPLICATIONS_DESCRIPTION "An extremely useful application that makes use of MyLib") set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION @@ -188,6 +188,7 @@ if(CPackGen MATCHES "RPM") /usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/depth_three /usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/depth_three/symlink_parentdir_path /usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_outside_package +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_outside_wdr /usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_relocatable_subpath /usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_samedir_path /usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_samedir_path_current_dir @@ -206,8 +207,8 @@ if(CPackGen MATCHES "RPM") /usr/foo/bar/other_relocatable /usr/foo/bar/other_relocatable/depth_two$") elseif(check_file_headers_match) - set(check_file_match_expected_summary ".*${CPACK_RPM_headers_PACKAGE_SUMMARY}.*") - set(check_file_match_expected_description ".*${CPACK_RPM_headers_PACKAGE_DESCRIPTION}.*") + set(check_file_match_expected_summary ".*${CPACK_RPM_HEADERS_PACKAGE_SUMMARY}.*") + set(check_file_match_expected_description ".*${CPACK_RPM_HEADERS_PACKAGE_DESCRIPTION}.*") set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}") set(check_file_match_expected_architecture "noarch") set(spec_regex "*headers*") @@ -304,6 +305,30 @@ if(CPackGen MATCHES "RPM") message(FATAL_ERROR "error: '${check_file}' rpm package content does not match expected value - regex '${check_content_list}'; RPM output: '${check_package_content}'; generated spec file: '${spec_file_content}'") endif() + + # validate permissions user and group + execute_process(COMMAND ${RPM_EXECUTABLE} -pqlv ${check_file} + OUTPUT_VARIABLE check_file_content + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if(check_file_libraries_match) + set(check_file_match_expected_permissions ".*-rwx------.*user.*defgrp.*") + elseif(check_file_headers_match) + set(check_file_match_expected_permissions ".*-rwxr--r--.*defusr.*defgrp.*") + elseif(check_file_applications_match) + set(check_file_match_expected_permissions ".*-rwxr--r--.*defusr.*group.*") + elseif(check_file_Unspecified_match) + set(check_file_match_expected_permissions ".*-rwxr--r--.*defusr.*defgrp.*") + else() + message(FATAL_ERROR "error: unexpected rpm package '${check_file}'") + endif() + + string(REGEX MATCH "${check_file_match_expected_permissions}" check_file_match_permissions "${check_file_content}") + + if(NOT check_file_match_permissions) + message(FATAL_ERROR "error: '${check_file}' rpm package permissions do not match expected value - regex '${check_file_match_expected_permissions}'") + endif() endforeach() ####################### @@ -330,6 +355,8 @@ if(CPackGen MATCHES "RPM") string(REGEX MATCH "^.*${whitespaces}->${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/non_relocatable/depth_two$" check_symlink "${SYMLINK_POINT_}") elseif("${symlink_name}" STREQUAL "symlink_outside_package") string(REGEX MATCH "^.*${whitespaces}->${whitespaces}outside_package$" check_symlink "${SYMLINK_POINT_}") + elseif("${symlink_name}" STREQUAL "symlink_outside_wdr") + string(REGEX MATCH "^.*${whitespaces}->${whitespaces}/outside_package_wdr$" check_symlink "${SYMLINK_POINT_}") elseif("${symlink_name}" STREQUAL "symlink_other_relocatable_path" OR "${symlink_name}" STREQUAL "symlink_from_non_relocatable_path" OR "${symlink_name}" STREQUAL "symlink_relocatable_subpath") diff --git a/Tests/RunCMake/CommandLine/DeprecateVS6-WARN-ON.cmake b/Tests/CTestCoverageCollectGCOV/TestProject/extra/uncovered1.cpp index e69de29..e69de29 100644 --- a/Tests/RunCMake/CommandLine/DeprecateVS6-WARN-ON.cmake +++ b/Tests/CTestCoverageCollectGCOV/TestProject/extra/uncovered1.cpp diff --git a/Tests/RunCMake/CommandLine/DeprecateVS6-WARN-OFF.cmake b/Tests/CTestCoverageCollectGCOV/TestProject/uncovered2.cpp index e69de29..e69de29 100644 --- a/Tests/RunCMake/CommandLine/DeprecateVS6-WARN-OFF.cmake +++ b/Tests/CTestCoverageCollectGCOV/TestProject/uncovered2.cpp diff --git a/Tests/CTestCoverageCollectGCOV/test.cmake.in b/Tests/CTestCoverageCollectGCOV/test.cmake.in index b2e6d6d..d48ef61 100644 --- a/Tests/CTestCoverageCollectGCOV/test.cmake.in +++ b/Tests/CTestCoverageCollectGCOV/test.cmake.in @@ -15,7 +15,9 @@ list(APPEND CTEST_CUSTOM_COVERAGE_EXCLUDE "/foo/something" "/3rdparty/" "/bar/somethingelse" + "/CMakeFiles/" ) +list(APPEND CTEST_EXTRA_COVERAGE_GLOB "*.cpp") include(CTestCoverageCollectGCOV) set(tar_file ${CTEST_BINARY_DIRECTORY}/gcov.tar) @@ -41,6 +43,8 @@ set(expected_out Testing/CoverageInfo/data.json Testing/CoverageInfo/extra.cpp.gcov Testing/CoverageInfo/main.cpp.gcov + uncovered/extra/uncovered1.cpp + uncovered/uncovered2.cpp ) if("${out}" STREQUAL "${expected_out}") diff --git a/Tests/CompileDefinitions/CMakeLists.txt b/Tests/CompileDefinitions/CMakeLists.txt index 13d1b01..1d8afbf 100644 --- a/Tests/CompileDefinitions/CMakeLists.txt +++ b/Tests/CompileDefinitions/CMakeLists.txt @@ -1,11 +1,6 @@ cmake_minimum_required(VERSION 2.8) project(CompileDefinitions) -if ("${CMAKE_GENERATOR}" STREQUAL "Visual Studio 6") - add_definitions(-DNO_SPACES_IN_DEFINE_VALUES) - set(NO_SPACES_IN_DEFINE_VALUES 1) -endif() - # Use compile flags to tell executables which config is built # without depending on the compile definitions functionality. foreach(c DEBUG RELEASE RELWITHDEBINFO MINSIZEREL) diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt index 9251ff3..83ca7f4 100644 --- a/Tests/Complex/CMakeLists.txt +++ b/Tests/Complex/CMakeLists.txt @@ -2,6 +2,7 @@ # A more complex test case # cmake_minimum_required(VERSION 2.4) +cmake_policy(SET CMP0054 NEW) project (Complex) # Test that renaming a built-in works when configured multiple times. @@ -438,6 +439,12 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL HP AND set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -AA") endif () +# Clang/C2 in C++98 mode cannot properly handle some of MSVC headers +if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND + CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") + set(CMAKE_CXX_STANDARD 11) +endif() + # # Create the libs and the main exe # diff --git a/Tests/Complex/Executable/CMakeLists.txt b/Tests/Complex/Executable/CMakeLists.txt index a1f8e68..c30dcbc 100644 --- a/Tests/Complex/Executable/CMakeLists.txt +++ b/Tests/Complex/Executable/CMakeLists.txt @@ -146,7 +146,8 @@ add_dependencies(notInAllCustom notInAllExe) # add_subdirectory(Temp) -if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_INCLUDE_SYSTEM_FLAG_CXX) +if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_INCLUDE_SYSTEM_FLAG_CXX + AND NOT XCODE) # XCODE is excluded due to #15687 add_executable(testSystemDir testSystemDir.cxx) set_target_properties(testSystemDir PROPERTIES COMPILE_FLAGS "-Werror") endif() diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt index 3b73e70..2d92809 100644 --- a/Tests/ComplexOneConfig/CMakeLists.txt +++ b/Tests/ComplexOneConfig/CMakeLists.txt @@ -2,6 +2,7 @@ # A more complex test case # cmake_minimum_required(VERSION 2.4) +cmake_policy(SET CMP0054 NEW) project (Complex) # Try setting a new policy. The IF test is for coverage. @@ -401,6 +402,12 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL HP AND set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -AA") endif () +# Clang/C2 in C++98 mode cannot properly handle some of MSVC headers +if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND + CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") + set(CMAKE_CXX_STANDARD 11) +endif() + # # Create the libs and the main exe # diff --git a/Tests/ComplexOneConfig/Executable/CMakeLists.txt b/Tests/ComplexOneConfig/Executable/CMakeLists.txt index b2307b2..4897b48 100644 --- a/Tests/ComplexOneConfig/Executable/CMakeLists.txt +++ b/Tests/ComplexOneConfig/Executable/CMakeLists.txt @@ -146,7 +146,8 @@ add_dependencies(notInAllCustom notInAllExe) # add_subdirectory(Temp) -if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_INCLUDE_SYSTEM_FLAG_CXX) +if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_INCLUDE_SYSTEM_FLAG_CXX + AND NOT XCODE) # XCODE is excluded due to #15687 add_executable(testSystemDir testSystemDir.cxx) set_target_properties(testSystemDir PROPERTIES COMPILE_FLAGS "-Werror") endif() diff --git a/Tests/CustomCommand/wrapper.cxx b/Tests/CustomCommand/wrapper.cxx index 93cb079..97912de 100644 --- a/Tests/CustomCommand/wrapper.cxx +++ b/Tests/CustomCommand/wrapper.cxx @@ -16,18 +16,12 @@ int main(int argc, char *argv[]) fprintf(fp,"int wrapped_help() { return 5; }\n"); fclose(fp); #ifdef CMAKE_INTDIR - /* The VS6 IDE passes a leading ".\\" in its variable expansion. */ -# if defined(_MSC_VER) && _MSC_VER == 1200 -# define CFG_DIR ".\\" CMAKE_INTDIR -# else -# define CFG_DIR CMAKE_INTDIR -# endif const char* cfg = (argc >= 4)? argv[3] : ""; - if(strcmp(cfg, CFG_DIR) != 0) + if(strcmp(cfg, CMAKE_INTDIR) != 0) { fprintf(stderr, "Did not receive expected configuration argument:\n" - " expected [" CFG_DIR "]\n" + " expected [" CMAKE_INTDIR "]\n" " received [%s]\n", cfg); return 1; } diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index c2ecb0b..f504c7b 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -79,12 +79,6 @@ set_property(TARGET testLib7 PROPERTY OUTPUT_NAME_DEBUG testLib7D-$<CONFIG>) set_property(TARGET testLib7 PROPERTY OUTPUT_NAME_RELEASE testLib7R-$<CONFIG>) set_property(TARGET testLib7 PROPERTY OUTPUT_NAME testLib7-$<CONFIG>) -# Work-around: Visual Studio 6 does not support per-target object files. -set(VS6) -if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 6") - set(VS6 1) -endif() - # Test using the target_link_libraries command to set the # LINK_INTERFACE_LIBRARIES* properties. We construct two libraries # providing the same two symbols. In each library one of the symbols @@ -93,8 +87,8 @@ endif() # configuration in which it is built. If the proper library is not # used via the link interface the import test will fail to link. add_library(testLib4lib STATIC testLib4lib.c) -add_library(testLib4libdbg STATIC testLib4libopt.c testLib4libdbg${VS6}.c) -add_library(testLib4libopt STATIC testLib4libdbg.c testLib4libopt${VS6}.c) +add_library(testLib4libdbg STATIC testLib4libopt.c testLib4libdbg.c) +add_library(testLib4libopt STATIC testLib4libdbg.c testLib4libopt.c) set_property(TARGET testLib4libdbg PROPERTY COMPILE_DEFINITIONS LIB_DBG) set_property(TARGET testLib4libopt PROPERTY COMPILE_DEFINITIONS LIB_OPT) target_link_libraries(testLib4 diff --git a/Tests/ExportImport/Export/testLib4libdbg1.c b/Tests/ExportImport/Export/testLib4libdbg1.c deleted file mode 100644 index cc56cf9..0000000 --- a/Tests/ExportImport/Export/testLib4libdbg1.c +++ /dev/null @@ -1 +0,0 @@ -#include "testLib4libdbg.c" diff --git a/Tests/ExportImport/Export/testLib4libopt1.c b/Tests/ExportImport/Export/testLib4libopt1.c deleted file mode 100644 index d9b5587..0000000 --- a/Tests/ExportImport/Export/testLib4libopt1.c +++ /dev/null @@ -1 +0,0 @@ -#include "testLib4libopt.c" diff --git a/Tests/ExternalProjectLocal/CMakeLists.txt b/Tests/ExternalProjectLocal/CMakeLists.txt index e1a67db..17f1630 100644 --- a/Tests/ExternalProjectLocal/CMakeLists.txt +++ b/Tests/ExternalProjectLocal/CMakeLists.txt @@ -23,18 +23,6 @@ set_property(DIRECTORY PROPERTY EP_STEP_TARGETS configure build test) if(NOT DEFINED can_build_tutorial_step5) set(can_build_tutorial_step5 1) - # Tutorial Step5 cannot build correctly using Visual Studio 6 - # on Windows 98 if the path of its build tree exceeds 72 - # characters in length... So don't attempt to build it - # in a long path on Win98: - # - if(CMAKE_SYSTEM STREQUAL "Windows-4.10") - string(LENGTH "${binary_base}/TutorialStep5-Local" n) - if(n GREATER 72) - set(can_build_tutorial_step5 0) - endif() - endif() - # The ExternalProject builds of Tutorial Step5 cannot be built # correctly 2nd and later times in an in-source build... # (because the CMakeCache.txt from the real in-source build of diff --git a/Tests/ExternalProjectSubdir/CMakeLists.txt b/Tests/ExternalProjectSubdir/CMakeLists.txt index e65087a..3a67ea0 100644 --- a/Tests/ExternalProjectSubdir/CMakeLists.txt +++ b/Tests/ExternalProjectSubdir/CMakeLists.txt @@ -3,11 +3,8 @@ project(ExternalProjectSubdir NONE) include(ExternalProject) # Remove the custom target output to be sure it runs in an -# incremental test. Skip this on VS 6 because it sometimes -# re-runs CMake after the custom command runs. -if(NOT CMAKE_GENERATOR STREQUAL "Visual Studio 6") - file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/PreSubdir1.txt) -endif() +# incremental test. +file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/PreSubdir1.txt) add_custom_target(PreSubdir1 COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/PreSubdir1.txt diff --git a/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake b/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake index 7065f36..8ea4452 100644 --- a/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake +++ b/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake @@ -99,7 +99,7 @@ was expected." endif() if( EXISTS ${FETCH_HEAD_file} ) - message( FATAL_ERROR "Fetch occured when it was not expected.") + message( FATAL_ERROR "Fetch occurred when it was not expected.") endif() # Check the resulting SHA diff --git a/Tests/FindGTK2/gtkmm/CMakeLists.txt b/Tests/FindGTK2/gtkmm/CMakeLists.txt index 32aafe2..eb0b7aa 100644 --- a/Tests/FindGTK2/gtkmm/CMakeLists.txt +++ b/Tests/FindGTK2/gtkmm/CMakeLists.txt @@ -12,3 +12,8 @@ target_link_libraries(gtkmm-target GTK2::gtkmm) add_executable(gtkmm-all-libs WIN32 main.cpp helloworld.cpp helloworld.h) target_link_libraries(gtkmm-all-libs ${GTK2_LIBRARIES}) target_include_directories(gtkmm-all-libs PRIVATE ${GTK2_INCLUDE_DIRS}) + +# Linking via the library variables does not cause compile feature +# requirements to propagate. Do it manually for purposes of this test. +get_property(features TARGET GTK2::sigc++ PROPERTY INTERFACE_COMPILE_FEATURES) +set_property(TARGET gtkmm-all-libs PROPERTY COMPILE_FEATURES ${features}) diff --git a/Tests/FindLTTngUST/CMakeLists.txt b/Tests/FindLTTngUST/CMakeLists.txt new file mode 100644 index 0000000..c9c471d --- /dev/null +++ b/Tests/FindLTTngUST/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindLTTngUST.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindLTTngUST/Test" + "${CMake_BINARY_DIR}/Tests/FindLTTngUST/Test" + ${build_generator_args} + --build-project TestFindLTTngUST + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) diff --git a/Tests/FindLTTngUST/Test/CMakeLists.txt b/Tests/FindLTTngUST/Test/CMakeLists.txt new file mode 100644 index 0000000..e5bd9f3 --- /dev/null +++ b/Tests/FindLTTngUST/Test/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.5) +project(TestFindLTTngUST C) +include(CTest) + +find_package(LTTngUST REQUIRED) + +add_definitions(-DCMAKE_EXPECTED_LTTNGUST_VERSION="${LTTNGUST_VERSION_STRING}") +add_definitions(-DCMAKE_LTTNGUST_HAS_TRACEF="${LTTNGUST_HAS_TRACEF}") +add_definitions(-DCMAKE_LTTNGUST_HAS_TRACELOG="${LTTNGUST_HAS_TRACELOG}") + +add_executable(test_tgt main.c) +target_link_libraries(test_tgt LTTng::UST) +add_test(NAME test_tgt COMMAND test_tgt) + +add_executable(test_var main.c) +target_include_directories(test_var PRIVATE ${LTTNGUST_INCLUDE_DIRS}) +target_link_libraries(test_var PRIVATE ${LTTNGUST_LIBRARIES}) +add_test(NAME test_var COMMAND test_var) diff --git a/Tests/FindLTTngUST/Test/main.c b/Tests/FindLTTngUST/Test/main.c new file mode 100644 index 0000000..ac775a0 --- /dev/null +++ b/Tests/FindLTTngUST/Test/main.c @@ -0,0 +1,31 @@ +#include <assert.h> +#include <string.h> +#include <stdio.h> +#include <lttng/ust-version.h> + +#ifdef CMAKE_LTTNGUST_HAS_TRACEF +#include <lttng/tracef.h> +#endif + +#ifdef CMAKE_LTTNGUST_HAS_TRACELOG +#include <lttng/tracelog.h> +#endif + +int main(void) +{ + char lttng_version_string[16]; + + snprintf(lttng_version_string, 16, "%u.%u.%u", LTTNG_UST_MAJOR_VERSION, + LTTNG_UST_MINOR_VERSION, LTTNG_UST_PATCHLEVEL_VERSION); + assert(!strcmp(lttng_version_string, CMAKE_EXPECTED_LTTNGUST_VERSION)); + +#ifdef CMAKE_LTTNGUST_HAS_TRACEF + tracef("calling tracef()! %d %s", -23, CMAKE_EXPECTED_LTTNGUST_VERSION); +#endif + +#ifdef CMAKE_LTTNGUST_HAS_TRACELOG + tracelog(TRACE_WARNING, "calling tracelog()! %d", 17); +#endif + + return 0; +} diff --git a/Tests/FindPackageModeMakefileTest/CMakeLists.txt b/Tests/FindPackageModeMakefileTest/CMakeLists.txt index 8e21c32..56fcc5d 100644 --- a/Tests/FindPackageModeMakefileTest/CMakeLists.txt +++ b/Tests/FindPackageModeMakefileTest/CMakeLists.txt @@ -1,6 +1,7 @@ -if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Makefile") +if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Makefile" AND + NOT CMake_TEST_NO_FindPackageModeMakefileTest) # Test whether the make is GNU make, and only add the test in this case, # since the configured makefile in this test uses $(shell ...), which diff --git a/Tests/Fortran/CMakeLists.txt b/Tests/Fortran/CMakeLists.txt index ecf38a6..1268982 100644 --- a/Tests/Fortran/CMakeLists.txt +++ b/Tests/Fortran/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.0) +cmake_minimum_required (VERSION 3.1) project(testf C CXX Fortran) if(NOT DEFINED CMake_TEST_NESTED_MAKE_PROGRAM AND NOT CMAKE_GENERATOR MATCHES "Visual Studio") set(CMake_TEST_NESTED_MAKE_PROGRAM "${CMAKE_MAKE_PROGRAM}") @@ -119,7 +119,7 @@ endfunction() # call the test_fortran_c_interface_module function if("${CMAKE_Fortran_COMPILER_ID}:${CMAKE_C_COMPILER_ID}" MATCHES "(Intel:MSVC|Absoft:GNU)" - OR (CMAKE_Fortran_COMPILER_ID MATCHES CMAKE_C_COMPILER_ID )) + OR ("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "${CMAKE_C_COMPILER_ID}" )) test_fortran_c_interface_module() else() message("Fortran does not match c compiler") diff --git a/Tests/Module/GenerateExportHeader/CMakeLists.txt b/Tests/Module/GenerateExportHeader/CMakeLists.txt index 8cd25a4..8b94ca7 100644 --- a/Tests/Module/GenerateExportHeader/CMakeLists.txt +++ b/Tests/Module/GenerateExportHeader/CMakeLists.txt @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION 2.8.5 FATAL_ERROR) +cmake_policy(SET CMP0054 NEW) project(GenerateExportHeader) @@ -66,6 +67,12 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL HP AND set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -AA") endif () +# Clang/C2 in C++98 mode cannot properly handle some of MSVC headers +if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND + CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") + set(CMAKE_CXX_STANDARD 11) +endif() + add_subdirectory(lib_shared_and_static) add_compiler_export_flags() @@ -107,7 +114,10 @@ add_executable(GenerateExportHeader exportheader_test.cpp) target_link_libraries(GenerateExportHeader ${link_libraries}) if (WIN32 OR CYGWIN) - if(MSVC AND COMPILER_HAS_DEPRECATED) + if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND + CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") + set(_platform Win32-Clang) + elseif(MSVC AND COMPILER_HAS_DEPRECATED) set(_platform Win32) elseif((MINGW OR CYGWIN) AND COMPILER_HAS_DEPRECATED) set(_platform MinGW) @@ -124,6 +134,6 @@ endif() message("#### Testing reference: ${_platform}") target_compile_definitions(GenerateExportHeader PRIVATE - "SRC_DIR=${CMAKE_CURRENT_SOURCE_DIR}/reference/${_platform}" - "BIN_DIR=${CMAKE_CURRENT_BINARY_DIR}" + "SRC_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/reference/${_platform}\"" + "BIN_DIR=\"${CMAKE_CURRENT_BINARY_DIR}\"" ) diff --git a/Tests/Module/GenerateExportHeader/exportheader_test.cpp b/Tests/Module/GenerateExportHeader/exportheader_test.cpp index 4f45f37..7802c43 100644 --- a/Tests/Module/GenerateExportHeader/exportheader_test.cpp +++ b/Tests/Module/GenerateExportHeader/exportheader_test.cpp @@ -136,13 +136,10 @@ int main() libstatic_not_exported(); libstatic_excluded(); -#define STRINGIFY_IMPL(A) #A -#define STRINGIFY(A) STRINGIFY_IMPL(A) - - compare(STRINGIFY(SRC_DIR) "/libshared_export.h", - STRINGIFY(BIN_DIR) "/libshared/libshared_export.h"); - compare(STRINGIFY(SRC_DIR) "/libstatic_export.h", - STRINGIFY(BIN_DIR) "/libstatic/libstatic_export.h"); + compare(SRC_DIR "/libshared_export.h", + BIN_DIR "/libshared/libshared_export.h"); + compare(SRC_DIR "/libstatic_export.h", + BIN_DIR "/libstatic/libstatic_export.h"); return 0; } diff --git a/Tests/Module/GenerateExportHeader/reference/Empty/libshared_export.h b/Tests/Module/GenerateExportHeader/reference/Empty/libshared_export.h index b6749b2..e8af0a5 100644 --- a/Tests/Module/GenerateExportHeader/reference/Empty/libshared_export.h +++ b/Tests/Module/GenerateExportHeader/reference/Empty/libshared_export.h @@ -33,9 +33,10 @@ # define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED #endif -#define DEFINE_NO_DEPRECATED 0 -#if DEFINE_NO_DEPRECATED -# define LIBSHARED_NO_DEPRECATED +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef LIBSHARED_NO_DEPRECATED +# define LIBSHARED_NO_DEPRECATED +# endif #endif #endif diff --git a/Tests/Module/GenerateExportHeader/reference/Empty/libstatic_export.h b/Tests/Module/GenerateExportHeader/reference/Empty/libstatic_export.h index e8000e2..598bd71 100644 --- a/Tests/Module/GenerateExportHeader/reference/Empty/libstatic_export.h +++ b/Tests/Module/GenerateExportHeader/reference/Empty/libstatic_export.h @@ -33,9 +33,10 @@ # define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED #endif -#define DEFINE_NO_DEPRECATED 0 -#if DEFINE_NO_DEPRECATED -# define LIBSTATIC_NO_DEPRECATED +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef LIBSTATIC_NO_DEPRECATED +# define LIBSTATIC_NO_DEPRECATED +# endif #endif #endif diff --git a/Tests/Module/GenerateExportHeader/reference/MinGW/libshared_export.h b/Tests/Module/GenerateExportHeader/reference/MinGW/libshared_export.h index d376631..cc20e09 100644 --- a/Tests/Module/GenerateExportHeader/reference/MinGW/libshared_export.h +++ b/Tests/Module/GenerateExportHeader/reference/MinGW/libshared_export.h @@ -33,9 +33,10 @@ # define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED #endif -#define DEFINE_NO_DEPRECATED 0 -#if DEFINE_NO_DEPRECATED -# define LIBSHARED_NO_DEPRECATED +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef LIBSHARED_NO_DEPRECATED +# define LIBSHARED_NO_DEPRECATED +# endif #endif #endif diff --git a/Tests/Module/GenerateExportHeader/reference/MinGW/libstatic_export.h b/Tests/Module/GenerateExportHeader/reference/MinGW/libstatic_export.h index fd021e9..4aaa848 100644 --- a/Tests/Module/GenerateExportHeader/reference/MinGW/libstatic_export.h +++ b/Tests/Module/GenerateExportHeader/reference/MinGW/libstatic_export.h @@ -33,9 +33,10 @@ # define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED #endif -#define DEFINE_NO_DEPRECATED 0 -#if DEFINE_NO_DEPRECATED -# define LIBSTATIC_NO_DEPRECATED +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef LIBSTATIC_NO_DEPRECATED +# define LIBSTATIC_NO_DEPRECATED +# endif #endif #endif diff --git a/Tests/Module/GenerateExportHeader/reference/UNIX/libshared_export.h b/Tests/Module/GenerateExportHeader/reference/UNIX/libshared_export.h index 7d8087f..053ad18 100644 --- a/Tests/Module/GenerateExportHeader/reference/UNIX/libshared_export.h +++ b/Tests/Module/GenerateExportHeader/reference/UNIX/libshared_export.h @@ -33,9 +33,10 @@ # define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED #endif -#define DEFINE_NO_DEPRECATED 0 -#if DEFINE_NO_DEPRECATED -# define LIBSHARED_NO_DEPRECATED +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef LIBSHARED_NO_DEPRECATED +# define LIBSHARED_NO_DEPRECATED +# endif #endif #endif diff --git a/Tests/Module/GenerateExportHeader/reference/UNIX/libstatic_export.h b/Tests/Module/GenerateExportHeader/reference/UNIX/libstatic_export.h index fd021e9..4aaa848 100644 --- a/Tests/Module/GenerateExportHeader/reference/UNIX/libstatic_export.h +++ b/Tests/Module/GenerateExportHeader/reference/UNIX/libstatic_export.h @@ -33,9 +33,10 @@ # define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED #endif -#define DEFINE_NO_DEPRECATED 0 -#if DEFINE_NO_DEPRECATED -# define LIBSTATIC_NO_DEPRECATED +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef LIBSTATIC_NO_DEPRECATED +# define LIBSTATIC_NO_DEPRECATED +# endif #endif #endif diff --git a/Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h b/Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h index 5681f58..808ff01 100644 --- a/Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h +++ b/Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h @@ -33,9 +33,10 @@ # define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED #endif -#define DEFINE_NO_DEPRECATED 0 -#if DEFINE_NO_DEPRECATED -# define LIBSHARED_NO_DEPRECATED +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef LIBSHARED_NO_DEPRECATED +# define LIBSHARED_NO_DEPRECATED +# endif #endif #endif diff --git a/Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h b/Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h index fd021e9..4aaa848 100644 --- a/Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h +++ b/Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h @@ -33,9 +33,10 @@ # define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED #endif -#define DEFINE_NO_DEPRECATED 0 -#if DEFINE_NO_DEPRECATED -# define LIBSTATIC_NO_DEPRECATED +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef LIBSTATIC_NO_DEPRECATED +# define LIBSTATIC_NO_DEPRECATED +# endif #endif #endif diff --git a/Tests/Module/GenerateExportHeader/reference/Win32-Clang/libshared_export.h b/Tests/Module/GenerateExportHeader/reference/Win32-Clang/libshared_export.h new file mode 100644 index 0000000..cc20e09 --- /dev/null +++ b/Tests/Module/GenerateExportHeader/reference/Win32-Clang/libshared_export.h @@ -0,0 +1,42 @@ + +#ifndef LIBSHARED_EXPORT_H +#define LIBSHARED_EXPORT_H + +#ifdef LIBSHARED_STATIC_DEFINE +# define LIBSHARED_EXPORT +# define LIBSHARED_NO_EXPORT +#else +# ifndef LIBSHARED_EXPORT +# ifdef libshared_EXPORTS + /* We are building this library */ +# define LIBSHARED_EXPORT __declspec(dllexport) +# else + /* We are using this library */ +# define LIBSHARED_EXPORT __declspec(dllimport) +# endif +# endif + +# ifndef LIBSHARED_NO_EXPORT +# define LIBSHARED_NO_EXPORT +# endif +#endif + +#ifndef LIBSHARED_DEPRECATED +# define LIBSHARED_DEPRECATED __attribute__ ((__deprecated__)) +#endif + +#ifndef LIBSHARED_DEPRECATED_EXPORT +# define LIBSHARED_DEPRECATED_EXPORT LIBSHARED_EXPORT LIBSHARED_DEPRECATED +#endif + +#ifndef LIBSHARED_DEPRECATED_NO_EXPORT +# define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED +#endif + +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef LIBSHARED_NO_DEPRECATED +# define LIBSHARED_NO_DEPRECATED +# endif +#endif + +#endif diff --git a/Tests/Module/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h b/Tests/Module/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h new file mode 100644 index 0000000..4aaa848 --- /dev/null +++ b/Tests/Module/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h @@ -0,0 +1,42 @@ + +#ifndef LIBSTATIC_EXPORT_H +#define LIBSTATIC_EXPORT_H + +#ifdef LIBSTATIC_STATIC_DEFINE +# define LIBSTATIC_EXPORT +# define LIBSTATIC_NO_EXPORT +#else +# ifndef LIBSTATIC_EXPORT +# ifdef libstatic_EXPORTS + /* We are building this library */ +# define LIBSTATIC_EXPORT +# else + /* We are using this library */ +# define LIBSTATIC_EXPORT +# endif +# endif + +# ifndef LIBSTATIC_NO_EXPORT +# define LIBSTATIC_NO_EXPORT +# endif +#endif + +#ifndef LIBSTATIC_DEPRECATED +# define LIBSTATIC_DEPRECATED __attribute__ ((__deprecated__)) +#endif + +#ifndef LIBSTATIC_DEPRECATED_EXPORT +# define LIBSTATIC_DEPRECATED_EXPORT LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED +#endif + +#ifndef LIBSTATIC_DEPRECATED_NO_EXPORT +# define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED +#endif + +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef LIBSTATIC_NO_DEPRECATED +# define LIBSTATIC_NO_DEPRECATED +# endif +#endif + +#endif diff --git a/Tests/Module/GenerateExportHeader/reference/Win32/libshared_export.h b/Tests/Module/GenerateExportHeader/reference/Win32/libshared_export.h index 976c92e..4e675af 100644 --- a/Tests/Module/GenerateExportHeader/reference/Win32/libshared_export.h +++ b/Tests/Module/GenerateExportHeader/reference/Win32/libshared_export.h @@ -33,9 +33,10 @@ # define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED #endif -#define DEFINE_NO_DEPRECATED 0 -#if DEFINE_NO_DEPRECATED -# define LIBSHARED_NO_DEPRECATED +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef LIBSHARED_NO_DEPRECATED +# define LIBSHARED_NO_DEPRECATED +# endif #endif #endif diff --git a/Tests/Module/GenerateExportHeader/reference/Win32/libstatic_export.h b/Tests/Module/GenerateExportHeader/reference/Win32/libstatic_export.h index db4df61..4d5ed4e 100644 --- a/Tests/Module/GenerateExportHeader/reference/Win32/libstatic_export.h +++ b/Tests/Module/GenerateExportHeader/reference/Win32/libstatic_export.h @@ -33,9 +33,10 @@ # define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED #endif -#define DEFINE_NO_DEPRECATED 0 -#if DEFINE_NO_DEPRECATED -# define LIBSTATIC_NO_DEPRECATED +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef LIBSTATIC_NO_DEPRECATED +# define LIBSTATIC_NO_DEPRECATED +# endif #endif #endif diff --git a/Tests/Module/GenerateExportHeader/reference/WinEmpty/libshared_export.h b/Tests/Module/GenerateExportHeader/reference/WinEmpty/libshared_export.h index 2dc41d4..84340e3 100644 --- a/Tests/Module/GenerateExportHeader/reference/WinEmpty/libshared_export.h +++ b/Tests/Module/GenerateExportHeader/reference/WinEmpty/libshared_export.h @@ -33,9 +33,10 @@ # define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED #endif -#define DEFINE_NO_DEPRECATED 0 -#if DEFINE_NO_DEPRECATED -# define LIBSHARED_NO_DEPRECATED +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef LIBSHARED_NO_DEPRECATED +# define LIBSHARED_NO_DEPRECATED +# endif #endif #endif diff --git a/Tests/Module/GenerateExportHeader/reference/WinEmpty/libstatic_export.h b/Tests/Module/GenerateExportHeader/reference/WinEmpty/libstatic_export.h index e8000e2..598bd71 100644 --- a/Tests/Module/GenerateExportHeader/reference/WinEmpty/libstatic_export.h +++ b/Tests/Module/GenerateExportHeader/reference/WinEmpty/libstatic_export.h @@ -33,9 +33,10 @@ # define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED #endif -#define DEFINE_NO_DEPRECATED 0 -#if DEFINE_NO_DEPRECATED -# define LIBSTATIC_NO_DEPRECATED +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef LIBSTATIC_NO_DEPRECATED +# define LIBSTATIC_NO_DEPRECATED +# endif #endif #endif diff --git a/Tests/ObjectLibrary/A/CMakeLists.txt b/Tests/ObjectLibrary/A/CMakeLists.txt index c24c5ed..188fd64 100644 --- a/Tests/ObjectLibrary/A/CMakeLists.txt +++ b/Tests/ObjectLibrary/A/CMakeLists.txt @@ -12,11 +12,8 @@ add_custom_command( ) # Remove the custom command output to be sure it runs in an -# incremental test. Skip this on VS 6 because it sometimes -# re-runs CMake after the custom command runs. -if(NOT CMAKE_GENERATOR STREQUAL "Visual Studio 6") - file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/a.cmake) -endif() +# incremental test. +file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/a.cmake) add_custom_command( OUTPUT a.cmake COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/a.cmake diff --git a/Tests/ObjectLibrary/B/CMakeLists.txt b/Tests/ObjectLibrary/B/CMakeLists.txt index 2158084..ecace4f 100644 --- a/Tests/ObjectLibrary/B/CMakeLists.txt +++ b/Tests/ObjectLibrary/B/CMakeLists.txt @@ -1,8 +1,4 @@ project(ObjectLibraryB C) -if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 6") - # VS 6 generator does not use per-target object locations. - set(vs6 _vs6) -endif() # Add -fPIC so objects can be used in shared libraries. set(CMAKE_POSITION_INDEPENDENT_CODE ON) @@ -11,7 +7,7 @@ add_library(B OBJECT b1.c b2.c) target_include_directories(B PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) target_compile_definitions(B PUBLIC B_DEF) -add_library(Bexport OBJECT b1${vs6}.c b2${vs6}.c) +add_library(Bexport OBJECT b1.c b2.c) set_property(TARGET Bexport PROPERTY COMPILE_DEFINITIONS Bexport) target_include_directories(Bexport PRIVATE $<TARGET_PROPERTY:B,INTERFACE_INCLUDE_DIRECTORIES>) target_compile_definitions(Bexport PRIVATE $<TARGET_PROPERTY:B,INTERFACE_COMPILE_DEFINITIONS>) diff --git a/Tests/ObjectLibrary/B/b1_vs6.c b/Tests/ObjectLibrary/B/b1_vs6.c deleted file mode 100644 index b606e10..0000000 --- a/Tests/ObjectLibrary/B/b1_vs6.c +++ /dev/null @@ -1 +0,0 @@ -#include "b1.c" diff --git a/Tests/ObjectLibrary/B/b2_vs6.c b/Tests/ObjectLibrary/B/b2_vs6.c deleted file mode 100644 index d96a43e..0000000 --- a/Tests/ObjectLibrary/B/b2_vs6.c +++ /dev/null @@ -1 +0,0 @@ -#include "b2.c" diff --git a/Tests/ObjectLibrary/CMakeLists.txt b/Tests/ObjectLibrary/CMakeLists.txt index e9f553e..e3476df 100644 --- a/Tests/ObjectLibrary/CMakeLists.txt +++ b/Tests/ObjectLibrary/CMakeLists.txt @@ -16,8 +16,8 @@ add_custom_command(TARGET UseCshared POST_BUILD COMMAND ${CMAKE_COMMAND} -P ${CM add_executable(UseCinternal main.c c.c $<TARGET_OBJECTS:A> $<TARGET_OBJECTS:B>) -if("${CMAKE_GENERATOR}" MATCHES "^Visual Studio (6|7|7 .NET 2003)$") - # VS 6 and 7 generators do not add objects as sources so we need a +if("${CMAKE_GENERATOR}" MATCHES "^Visual Studio (7|7 .NET 2003)$") + # VS 7 generators do not add objects as sources so we need a # dummy object to convince the IDE to build the targets below. set(dummy dummy.obj) # In MinGW: gcc -c dummy.c -o dummy.obj elseif("${CMAKE_GENERATOR}" MATCHES "Xcode") diff --git a/Tests/PDBDirectoryAndName/CMakeLists.txt b/Tests/PDBDirectoryAndName/CMakeLists.txt index 180f9fe..2fb894e 100644 --- a/Tests/PDBDirectoryAndName/CMakeLists.txt +++ b/Tests/PDBDirectoryAndName/CMakeLists.txt @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION 2.8) +cmake_policy(SET CMP0054 NEW) project(PDBDirectoryAndName C) # Make sure the proper compiler is in use. @@ -62,14 +63,17 @@ list(APPEND my_targets myexe2) target_link_libraries(myexe2 mylibA mylibD) -#----------------------------------------------------------------------------- -# Check that PDB files actually appear where expected. -# The PDB_NAME and PDB_OUTPUT_DIRECTORY options do not work in VS 6. -if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 6") - return() +# Clang/C2 does not produce pdb files for static libraries +if (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND + CMAKE_C_SIMULATE_ID STREQUAL "MSVC") + list(REMOVE_ITEM my_targets mylibB mylibD) endif() + +#----------------------------------------------------------------------------- +# Check that PDB files actually appear where expected. + set(pdbs "") foreach(t ${my_targets}) get_property(pdb_name TARGET ${t} PROPERTY PDB_NAME) diff --git a/Tests/Plugin/CMakeLists.txt b/Tests/Plugin/CMakeLists.txt index 2b7bac1..49ff317 100644 --- a/Tests/Plugin/CMakeLists.txt +++ b/Tests/Plugin/CMakeLists.txt @@ -1,4 +1,5 @@ cmake_minimum_required (VERSION 2.6) +cmake_policy(SET CMP0054 NEW) project(Plugin) # Test per-target output directory properties. @@ -34,6 +35,12 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL HP AND set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -AA") endif () +# Clang/C2 in C++98 mode cannot properly handle some of MSVC headers +if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND + CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") + set(CMAKE_CXX_STANDARD 11) +endif() + # Create an executable that exports an API for use by plugins. add_executable(example_exe src/example_exe.cxx) set_target_properties(example_exe PROPERTIES diff --git a/Tests/PrecompiledHeader/CMakeLists.txt b/Tests/PrecompiledHeader/CMakeLists.txt index 98bdd88..a804538 100644 --- a/Tests/PrecompiledHeader/CMakeLists.txt +++ b/Tests/PrecompiledHeader/CMakeLists.txt @@ -17,14 +17,8 @@ else() file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/PCH) endif() -# The VS6 IDE does not support renaming .pch files with /Fp. -if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 6") - set(PCH_USE_INCLUDE_DIR 1) - set(PCH_FILE) -else() - set(PCH_USE_INCLUDE_DIR 0) - set(PCH_FILE "\"/Fp${PCH_DIR}/foo_precompiled.pch\"") -endif() +set(PCH_USE_INCLUDE_DIR 0) +set(PCH_FILE "\"/Fp${PCH_DIR}/foo_precompiled.pch\"") # Choose between an explicit include path and using /I during # precompilation. The /I form is used to test that the PCH is diff --git a/Tests/Preprocess/CMakeLists.txt b/Tests/Preprocess/CMakeLists.txt index 15e2aca..b930f56 100644 --- a/Tests/Preprocess/CMakeLists.txt +++ b/Tests/Preprocess/CMakeLists.txt @@ -10,9 +10,6 @@ project(Preprocess) if("${CMAKE_GENERATOR}" MATCHES "Xcode") set(PP_XCODE 1) endif() -if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 6") - set(PP_VS6 1) -endif() if("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles") set(PP_UMAKE 1) endif() @@ -60,20 +57,15 @@ if(NOT BORLAND AND NOT PP_VS70) set(SEMICOLON "\;") endif() -if(NOT PP_VS6) - # VS 6 IDE: spaces and '"', '$', or ';' - # The project parser cannot handle spaces if there are quotes. - # Since we test passing in a quoted string, we cannot have spaces. - set(STRING_EXTRA "${STRING_EXTRA} ") +set(STRING_EXTRA "${STRING_EXTRA} ") - if(NOT PP_BORLAND AND NOT PP_WATCOM) - # Borland, WMake: multiple spaces - # The make tool seems to remove extra whitespace from inside - # quoted strings when passing to the compiler. It does not have - # trouble passing to other tools, and the compiler may be directly - # invoked from the command line. - set(STRING_EXTRA "${STRING_EXTRA} ") - endif() +if(NOT PP_BORLAND AND NOT PP_WATCOM) + # Borland, WMake: multiple spaces + # The make tool seems to remove extra whitespace from inside + # quoted strings when passing to the compiler. It does not have + # trouble passing to other tools, and the compiler may be directly + # invoked from the command line. + set(STRING_EXTRA "${STRING_EXTRA} ") endif() if(NOT PP_VS) @@ -201,14 +193,10 @@ endif() set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DPREPROCESS_DEBUG") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DPREPROCESS_DEBUG") -# Inform the test if it built from Xcode or VS6 IDE. +# Inform the test if it built from Xcode. if(PP_XCODE) set(PREPROCESS_XCODE 1) endif() -if(PP_VS6) - set(PREPROCESS_VS6 1) - set(VS6 _vs6) -endif() # Test old-style definitions. add_definitions(-DOLD_DEF -DOLD_EXPR=2) @@ -220,7 +208,7 @@ if(NOT "${OLD_DEFS}" STREQUAL "${OLD_DEFS_EXPECTED}") message(SEND_ERROR "add_definitions not converted to directory property!") endif() -add_executable(Preprocess preprocess.c preprocess${VS6}.cxx) +add_executable(Preprocess preprocess.c preprocess.cxx) set(FILE_PATH "${Preprocess_SOURCE_DIR}/file_def.h") set(TARGET_PATH "${Preprocess_SOURCE_DIR}/target_def.h") @@ -236,17 +224,14 @@ foreach(c "" "_DEBUG" "_RELEASE") PROPERTY COMPILE_DEFINITIONS${c} "TARGET_DEF${c}" ) set_property( - SOURCE preprocess.c preprocess${VS6}.cxx + SOURCE preprocess.c preprocess.cxx PROPERTY COMPILE_DEFINITIONS${c} "FILE_DEF${c}" ) endforeach() # Add definitions with values. -if(NOT PREPROCESS_VS6) - # The path might have spaces, which VS6 does not support. - set(DEF_TARGET_PATH "TARGET_PATH=\"${TARGET_PATH}\"") - set(DEF_FILE_PATH "FILE_PATH=\"${FILE_PATH}\"") -endif() +set(DEF_TARGET_PATH "TARGET_PATH=\"${TARGET_PATH}\"") +set(DEF_FILE_PATH "FILE_PATH=\"${FILE_PATH}\"") set_property( TARGET Preprocess APPEND PROPERTY COMPILE_DEFINITIONS @@ -255,7 +240,7 @@ set_property( ${DEF_TARGET_PATH} ) set_property( - SOURCE preprocess.c preprocess${VS6}.cxx + SOURCE preprocess.c preprocess.cxx APPEND PROPERTY COMPILE_DEFINITIONS "FILE_STRING=\"${STRING_VALUE}${SEMICOLON}\"" "FILE_EXPR=${EXPR}" diff --git a/Tests/Preprocess/preprocess.h.in b/Tests/Preprocess/preprocess.h.in index 3e1c7a0..e058a58 100644 --- a/Tests/Preprocess/preprocess.h.in +++ b/Tests/Preprocess/preprocess.h.in @@ -2,12 +2,6 @@ #define STRING_VALUE "@STRING_VALUE@" #define EXPR @EXPR@ #cmakedefine PREPROCESS_XCODE -#cmakedefine PREPROCESS_VS6 - -#ifdef PREPROCESS_VS6 -# define FILE_PATH "@FILE_PATH@" -# define TARGET_PATH "@TARGET_PATH@" -#endif /* Declarations and macros shared by all sources. */ #define TO_STRING(x) TO_STRING0(x) diff --git a/Tests/Preprocess/preprocess_vs6.cxx b/Tests/Preprocess/preprocess_vs6.cxx deleted file mode 100644 index 9df89f6..0000000 --- a/Tests/Preprocess/preprocess_vs6.cxx +++ /dev/null @@ -1,3 +0,0 @@ -// The VS6 IDE does not support object name configuration so we need a -// source file with a different name. Include the real source file. -#include "preprocess.cxx" diff --git a/Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake b/Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake index 3784a6a..f268de7 100644 --- a/Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake +++ b/Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake @@ -6,8 +6,8 @@ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") # configure the AutoExport test run_cmake(AutoExport) unset(RunCMake_TEST_OPTIONS) -# don't run this test on VS 6 as it is not supported -if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 6|Watcom WMake|Borland Makefiles") +# don't run this test on Watcom or Borland make as it is not supported +if("${RunCMake_GENERATOR}" MATCHES "Watcom WMake|Borland Makefiles") return() endif() # we build debug so the say.exe will be found in Debug/say.exe for diff --git a/Tests/RunCMake/BuildDepends/MakeInProjectOnly.c b/Tests/RunCMake/BuildDepends/MakeInProjectOnly.c new file mode 100644 index 0000000..bcb8745 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/MakeInProjectOnly.c @@ -0,0 +1,2 @@ +#include <MakeInProjectOnly.h> +int main() { return MakeInProjectOnly(); } diff --git a/Tests/RunCMake/BuildDepends/MakeInProjectOnly.cmake b/Tests/RunCMake/BuildDepends/MakeInProjectOnly.cmake new file mode 100644 index 0000000..add9aeb --- /dev/null +++ b/Tests/RunCMake/BuildDepends/MakeInProjectOnly.cmake @@ -0,0 +1,16 @@ +enable_language(C) +get_filename_component(include_dir "${CMAKE_BINARY_DIR}" PATH) +include_directories("${include_dir}") +add_executable(MakeInProjectOnly MakeInProjectOnly.c) +set(CMAKE_DEPENDS_IN_PROJECT_ONLY 1) +file(GENERATE OUTPUT check-$<LOWER_CASE:$<CONFIG>>.cmake CONTENT " +if (check_step EQUAL 1) + set(check_pairs + \"$<TARGET_FILE:MakeInProjectOnly>|${include_dir}/MakeInProjectOnly.h\" + ) +else() + set(check_pairs + \"${include_dir}/MakeInProjectOnly.h|\$<TARGET_FILE:MakeInProjectOnly>\" + ) +endif() +") diff --git a/Tests/RunCMake/BuildDepends/MakeInProjectOnly.step1.cmake b/Tests/RunCMake/BuildDepends/MakeInProjectOnly.step1.cmake new file mode 100644 index 0000000..d6551ab --- /dev/null +++ b/Tests/RunCMake/BuildDepends/MakeInProjectOnly.step1.cmake @@ -0,0 +1,3 @@ +file(WRITE "${RunCMake_TEST_BINARY_DIR}/../MakeInProjectOnly.h" [[ +int MakeInProjectOnly(void) { return 0; } +]]) diff --git a/Tests/RunCMake/BuildDepends/MakeInProjectOnly.step2.cmake b/Tests/RunCMake/BuildDepends/MakeInProjectOnly.step2.cmake new file mode 100644 index 0000000..145605b --- /dev/null +++ b/Tests/RunCMake/BuildDepends/MakeInProjectOnly.step2.cmake @@ -0,0 +1,3 @@ +file(WRITE "${RunCMake_TEST_BINARY_DIR}/../MakeInProjectOnly.h" [[ +int MakeInProjectOnly(void) { return 1; } +]]) diff --git a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake index 0dd27d4..8541070 100644 --- a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake +++ b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake @@ -30,7 +30,7 @@ function(run_BuildDepends CASE) endfunction() run_BuildDepends(C-Exe) -if(NOT RunCMake_GENERATOR MATCHES "Visual Studio [67]|Xcode") +if(NOT RunCMake_GENERATOR MATCHES "Visual Studio 7|Xcode") if(RunCMake_GENERATOR MATCHES "Visual Studio 10") # VS 10 forgets to re-link when a manifest changes set(run_BuildDepends_skip_step_2 1) @@ -41,3 +41,47 @@ endif() run_BuildDepends(Custom-Symbolic-and-Byproduct) run_BuildDepends(Custom-Always) + +if(RunCMake_GENERATOR MATCHES "Make" AND + NOT "${RunCMake_BINARY_DIR}" STREQUAL "${RunCMake_SOURCE_DIR}") + run_BuildDepends(MakeInProjectOnly) +endif() + +function(run_ReGeneration) + # test re-generation of project even if CMakeLists.txt files disappeared + + # Use a single build tree for a few tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/regenerate-project-build) + set(RunCMake_TEST_SOURCE_DIR ${RunCMake_BINARY_DIR}/regenerate-project-source) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(REMOVE_RECURSE "${RunCMake_TEST_SOURCE_DIR}") + set(ProjectHeader [=[ + cmake_minimum_required(VERSION 3.5) + project(Regenerate-Project NONE) + ]=]) + + # create project with subdirectory + file(WRITE "${RunCMake_TEST_SOURCE_DIR}/CMakeLists.txt" "${ProjectHeader}" + "add_subdirectory(mysubdir)") + file(MAKE_DIRECTORY "${RunCMake_TEST_SOURCE_DIR}/mysubdir") + file(WRITE "${RunCMake_TEST_SOURCE_DIR}/mysubdir/CMakeLists.txt" "# empty") + + run_cmake(Regenerate-Project) + execute_process(COMMAND ${CMAKE_COMMAND} -E sleep ${fs_delay}) + + # now we delete the subdirectory and adjust the CMakeLists.txt + file(REMOVE_RECURSE "${RunCMake_TEST_SOURCE_DIR}/mysubdir") + file(WRITE "${RunCMake_TEST_SOURCE_DIR}/CMakeLists.txt" "${ProjectHeader}") + + run_cmake_command(Regenerate-Project-Directory-Removed + ${CMAKE_COMMAND} --build "${RunCMake_TEST_BINARY_DIR}") + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_SOURCE_DIR) + unset(RunCMake_TEST_NO_CLEAN) +endfunction() + +if(RunCMake_GENERATOR STREQUAL "Xcode") + run_ReGeneration(regenerate-project) +endif() diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 0a388c5..d22c39c 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -152,6 +152,7 @@ add_RunCMake_test(ObjectLibrary) add_RunCMake_test(Swift) add_RunCMake_test(TargetObjects) add_RunCMake_test(TargetSources) +add_RunCMake_test(ToolchainFile) add_RunCMake_test(find_dependency) add_RunCMake_test(CompileDefinitions) add_RunCMake_test(CompileFeatures) @@ -216,6 +217,7 @@ add_RunCMake_test(alias_targets) add_RunCMake_test(interface_library) add_RunCMake_test(no_install_prefix) add_RunCMake_test(configure_file) +add_RunCMake_test(CTestTimeoutAfterMatch) find_package(Qt4 QUIET) find_package(Qt5Core QUIET) @@ -231,9 +233,16 @@ if(PKG_CONFIG_FOUND) add_RunCMake_test(FindPkgConfig) endif() -if("${CMAKE_GENERATOR}" MATCHES "Visual Studio [^6]") +if("${CMAKE_GENERATOR}" MATCHES "Visual Studio") add_RunCMake_test(include_external_msproject) - add_RunCMake_test(SolutionGlobalSections) + if("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([789]|10)" AND NOT CMAKE_VS_DEVENV_COMMAND) + set(NO_USE_FOLDERS 1) + endif() + add_RunCMake_test(VSSolution -DNO_USE_FOLDERS=${NO_USE_FOLDERS}) +endif() + +if("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([^789]|[789][0-9])") + add_RunCMake_test(VS10Project) endif() if(XCODE_VERSION AND NOT "${XCODE_VERSION}" VERSION_LESS 3) diff --git a/Tests/RunCMake/CPack/INSTALL_SCRIPTS.cmake b/Tests/RunCMake/CPack/INSTALL_SCRIPTS.cmake new file mode 100644 index 0000000..13aa77b --- /dev/null +++ b/Tests/RunCMake/CPack/INSTALL_SCRIPTS.cmake @@ -0,0 +1,26 @@ +set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) + +# default +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_install.sh" + "echo \"pre install\"\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_install.sh" + "echo \"post install\"\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall.sh" + "echo \"pre uninstall\"\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall.sh" + "echo \"post uninstall\"\n") + +# specific +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_install_foo.sh" + "echo \"pre install foo\"\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_install_foo.sh" + "echo \"post install foo\"\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall_foo.sh" + "echo \"pre uninstall foo\"\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall_foo.sh" + "echo \"post uninstall foo\"\n") + +install(FILES CMakeLists.txt DESTINATION foo COMPONENT foo) +install(FILES CMakeLists.txt DESTINATION bar COMPONENT bar) + +set(CPACK_PACKAGE_NAME "install_scripts") diff --git a/Tests/RunCMake/CPack/RPM/DEPENDENCIES-specifics.cmake b/Tests/RunCMake/CPack/RPM/DEPENDENCIES-specifics.cmake index 2cdfece..8b7fb1e 100644 --- a/Tests/RunCMake/CPack/RPM/DEPENDENCIES-specifics.cmake +++ b/Tests/RunCMake/CPack/RPM/DEPENDENCIES-specifics.cmake @@ -4,19 +4,19 @@ set(CPACK_RPM_COMPONENT_INSTALL "ON") # does not use them correctly: https://bugs.launchpad.net/rpm/+bug/1475755 set(CPACK_RPM_PACKAGE_AUTOREQ "no") set(CPACK_RPM_PACKAGE_AUTOPROV "no") -set(CPACK_RPM_applications_auto_PACKAGE_AUTOREQPROV "yes") -set(CPACK_RPM_libs_auto_PACKAGE_AUTOREQPROV "yes") +set(CPACK_RPM_APPLICATIONS_AUTO_PACKAGE_AUTOREQPROV "yes") +set(CPACK_RPM_LIBS_AUTO_PACKAGE_AUTOREQPROV "yes") set(CPACK_RPM_PACKAGE_REQUIRES "depend-default, depend-default-b") -set(CPACK_RPM_applications_PACKAGE_REQUIRES "depend-application, depend-application-b") -set(CPACK_RPM_applications_auto_PACKAGE_REQUIRES "depend-application, depend-application-b") -set(CPACK_RPM_headers_PACKAGE_REQUIRES "depend-headers") +set(CPACK_RPM_APPLICATIONS_PACKAGE_REQUIRES "depend-application, depend-application-b") +set(CPACK_RPM_APPLICATIONS_AUTO_PACKAGE_REQUIRES "depend-application, depend-application-b") +set(CPACK_RPM_HEADERS_PACKAGE_REQUIRES "depend-headers") set(CPACK_RPM_PACKAGE_CONFLICTS "conflict-default, conflict-default-b") -set(CPACK_RPM_applications_PACKAGE_CONFLICTS "conflict-application, conflict-application-b") -set(CPACK_RPM_applications_auto_PACKAGE_CONFLICTS "conflict-application, conflict-application-b") -set(CPACK_RPM_headers_PACKAGE_CONFLICTS "conflict-headers") +set(CPACK_RPM_APPLICATIONS_PACKAGE_CONFLICTS "conflict-application, conflict-application-b") +set(CPACK_RPM_APPLICATIONS_AUTO_PACKAGE_CONFLICTS "conflict-application, conflict-application-b") +set(CPACK_RPM_HEADERS_PACKAGE_CONFLICTS "conflict-headers") set(CPACK_RPM_PACKAGE_PROVIDES "provided-default, provided-default-b") -set(CPACK_RPM_libs_PACKAGE_PROVIDES "provided-lib") -set(CPACK_RPM_libs_auto_PACKAGE_PROVIDES "provided-lib_auto, provided-lib_auto-b") +set(CPACK_RPM_LIBS_PACKAGE_PROVIDES "provided-lib") +set(CPACK_RPM_LIBS_AUTO_PACKAGE_PROVIDES "provided-lib_auto, provided-lib_auto-b") diff --git a/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-ExpectedFiles.cmake new file mode 100644 index 0000000..033a45d --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-ExpectedFiles.cmake @@ -0,0 +1,7 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "2") +set(EXPECTED_FILE_1 "install_scripts*-foo.rpm") +set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$") +set(EXPECTED_FILE_2 "install_scripts*-bar.rpm") +set(EXPECTED_FILE_CONTENT_2 "^/usr/bar${whitespaces_}/usr/bar/CMakeLists.txt$") diff --git a/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-VerifyResult.cmake b/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-VerifyResult.cmake new file mode 100644 index 0000000..d7d82f2 --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-VerifyResult.cmake @@ -0,0 +1,29 @@ +function(checkScripts_ FILE COMPARE_LIST) + set(whitespaces_ "[\t\n\r ]*") + + execute_process(COMMAND ${RPM_EXECUTABLE} -qp --scripts ${FILE} + WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" + OUTPUT_VARIABLE FILE_SCRIPTS_ + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + + string(REPLACE "\n" ";" FILE_SCRIPTS_LIST_ "${FILE_SCRIPTS_}") + + foreach(COMPARE_REGEX_ IN LISTS COMPARE_LIST) + unset(FOUND_) + + foreach(COMPARE_ IN LISTS FILE_SCRIPTS_LIST_) + if(COMPARE_ MATCHES "${COMPARE_REGEX_}") + set(FOUND_ true) + break() + endif() + endforeach() + + if(NOT FOUND_) + message(FATAL_ERROR "Missing scripts in '${FILE}'; file info: '${FILE_SCRIPTS_}'; missing: '${COMPARE_REGEX_}'") + endif() + endforeach() +endfunction() + +checkScripts_("${FOUND_FILE_1}" "echo \"pre install foo\";echo \"post install foo\";echo \"pre uninstall foo\";echo \"post uninstall foo\"") +checkScripts_("${FOUND_FILE_2}" "echo \"pre install\";echo \"post install\";echo \"pre uninstall\";echo \"post uninstall\"") diff --git a/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-specifics.cmake b/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-specifics.cmake new file mode 100644 index 0000000..4eb53c3 --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-specifics.cmake @@ -0,0 +1,19 @@ +set(CPACK_RPM_COMPONENT_INSTALL "ON") + +set(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE + "${CMAKE_CURRENT_BINARY_DIR}/pre_install.sh") +set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE + "${CMAKE_CURRENT_BINARY_DIR}/post_install.sh") +set(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE + "${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall.sh") +set(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE + "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall.sh") + +set(CPACK_RPM_foo_PRE_INSTALL_SCRIPT_FILE + "${CMAKE_CURRENT_BINARY_DIR}/pre_install_foo.sh") +set(CPACK_RPM_foo_POST_INSTALL_SCRIPT_FILE + "${CMAKE_CURRENT_BINARY_DIR}/post_install_foo.sh") +set(CPACK_RPM_foo_PRE_UNINSTALL_SCRIPT_FILE + "${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall_foo.sh") +set(CPACK_RPM_foo_POST_UNINSTALL_SCRIPT_FILE + "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall_foo.sh") diff --git a/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-specifics.cmake b/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-specifics.cmake index d398168..524ef0c 100644 --- a/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-specifics.cmake +++ b/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-specifics.cmake @@ -1,5 +1,5 @@ set(CPACK_RPM_COMPONENT_INSTALL "ON") set(CPACK_RPM_PACKAGE_GROUP "default") -set(CPACK_RPM_pkg_2_PACKAGE_NAME "second") -set(CPACK_RPM_pkg_2_PACKAGE_GROUP "second_group") +set(CPACK_RPM_PKG_2_PACKAGE_NAME "second") +set(CPACK_RPM_PKG_2_PACKAGE_GROUP "second_group") diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index fe2b48b..ee4112d 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -11,3 +11,4 @@ run_cpack_test(DEPENDENCIES "RPM;DEB" true) run_cpack_test(EMPTY_DIR "RPM;DEB;TGZ" true) run_cpack_test(COMPONENTS_EMPTY_DIR "RPM;DEB;TGZ" true) run_cpack_test(PER_COMPONENT_FIELDS "RPM;DEB" false) +run_cpack_test(INSTALL_SCRIPTS "RPM" false) diff --git a/Tests/RunCMake/CTestTimeoutAfterMatch/CMakeLists.txt.in b/Tests/RunCMake/CTestTimeoutAfterMatch/CMakeLists.txt.in new file mode 100644 index 0000000..e9592f6 --- /dev/null +++ b/Tests/RunCMake/CTestTimeoutAfterMatch/CMakeLists.txt.in @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.4) +project(TimeoutAfterMatch NONE) +include(CTest) +add_test(NAME SleepFor1Second COMMAND "${CMAKE_COMMAND}" -P ${CMAKE_SOURCE_DIR}/SleepFor1Second.cmake) +set_property(TEST SleepFor1Second PROPERTY TIMEOUT 30) +set_property(TEST SleepFor1Second PROPERTY TIMEOUT_AFTER_MATCH "${arg1}" "${arg2}") diff --git a/Tests/RunCMake/CTestTimeoutAfterMatch/CTestConfig.cmake.in b/Tests/RunCMake/CTestTimeoutAfterMatch/CTestConfig.cmake.in new file mode 100644 index 0000000..58b11af --- /dev/null +++ b/Tests/RunCMake/CTestTimeoutAfterMatch/CTestConfig.cmake.in @@ -0,0 +1 @@ +set(CTEST_PROJECT_NAME "TimeoutAfterMatch@CASE_NAME@") diff --git a/Tests/RunCMake/CTestTimeoutAfterMatch/MissingArg1-stderr.txt b/Tests/RunCMake/CTestTimeoutAfterMatch/MissingArg1-stderr.txt new file mode 100644 index 0000000..7766c68 --- /dev/null +++ b/Tests/RunCMake/CTestTimeoutAfterMatch/MissingArg1-stderr.txt @@ -0,0 +1 @@ +TIMEOUT_AFTER_MATCH expects two arguments, found 1 diff --git a/Tests/RunCMake/CTestTimeoutAfterMatch/MissingArg2-stderr.txt b/Tests/RunCMake/CTestTimeoutAfterMatch/MissingArg2-stderr.txt new file mode 100644 index 0000000..7766c68 --- /dev/null +++ b/Tests/RunCMake/CTestTimeoutAfterMatch/MissingArg2-stderr.txt @@ -0,0 +1 @@ +TIMEOUT_AFTER_MATCH expects two arguments, found 1 diff --git a/Tests/RunCMake/CTestTimeoutAfterMatch/RunCMakeTest.cmake b/Tests/RunCMake/CTestTimeoutAfterMatch/RunCMakeTest.cmake new file mode 100644 index 0000000..ee4db83 --- /dev/null +++ b/Tests/RunCMake/CTestTimeoutAfterMatch/RunCMakeTest.cmake @@ -0,0 +1,11 @@ +include(RunCTest) + +function(run_ctest_TimeoutAfterMatch CASE_NAME) + set(CASE_PROPERTY_ARGS "${ARGN}") + run_ctest(${CASE_NAME}) +endfunction() + +run_ctest_TimeoutAfterMatch(MissingArg1 "\"-Darg2=Test started\"") +run_ctest_TimeoutAfterMatch(MissingArg2 "\"-Darg1=2\"") +run_ctest_TimeoutAfterMatch(ShouldTimeout "\"-Darg1=1\" \"-Darg2=Test started\"") +run_ctest_TimeoutAfterMatch(ShouldPass "\"-Darg1=15\" \"-Darg2=Test started\"") diff --git a/Tests/RunCMake/CTestTimeoutAfterMatch/ShouldPass-stdout.txt b/Tests/RunCMake/CTestTimeoutAfterMatch/ShouldPass-stdout.txt new file mode 100644 index 0000000..89aae56 --- /dev/null +++ b/Tests/RunCMake/CTestTimeoutAfterMatch/ShouldPass-stdout.txt @@ -0,0 +1,6 @@ + Start 1: SleepFor1Second +1/1 Test #1: SleepFor1Second .................. Passed +[0-9.]+ sec ++ +100% tests passed, 0 tests failed out of 1 ++ +Total Test time \(real\) = +[0-9.]+ sec$ diff --git a/Tests/RunCMake/CTestTimeoutAfterMatch/ShouldTimeout-stdout.txt b/Tests/RunCMake/CTestTimeoutAfterMatch/ShouldTimeout-stdout.txt new file mode 100644 index 0000000..c031eb0 --- /dev/null +++ b/Tests/RunCMake/CTestTimeoutAfterMatch/ShouldTimeout-stdout.txt @@ -0,0 +1 @@ +1 - SleepFor1Second \(Timeout\) diff --git a/Tests/RunCMake/CTestTimeoutAfterMatch/SleepFor1Second.cmake b/Tests/RunCMake/CTestTimeoutAfterMatch/SleepFor1Second.cmake new file mode 100644 index 0000000..82c2a44 --- /dev/null +++ b/Tests/RunCMake/CTestTimeoutAfterMatch/SleepFor1Second.cmake @@ -0,0 +1,4 @@ +execute_process(COMMAND "${CMAKE_COMMAND}" -E echo "Gathering required resources") +execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 2) +execute_process(COMMAND "${CMAKE_COMMAND}" -E echo "Test started") +execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) diff --git a/Tests/RunCMake/CTestTimeoutAfterMatch/test.cmake.in b/Tests/RunCMake/CTestTimeoutAfterMatch/test.cmake.in new file mode 100644 index 0000000..d049c9f --- /dev/null +++ b/Tests/RunCMake/CTestTimeoutAfterMatch/test.cmake.in @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.4) + +set(CTEST_SITE "test-site") +set(CTEST_BUILD_NAME "test-build-name") +set(CTEST_SOURCE_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@") +set(CTEST_BINARY_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@-build") +set(CTEST_CMAKE_GENERATOR "@RunCMake_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") + +configure_file( + "@RunCMake_SOURCE_DIR@/SleepFor1Second.cmake" + "${CTEST_SOURCE_DIRECTORY}/SleepFor1Second.cmake" + COPYONLY) + +set(options @CASE_PROPERTY_ARGS@) + +ctest_start(Experimental) +ctest_configure(OPTIONS "${options}") +ctest_test() diff --git a/Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-result.txt b/Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-stderr.txt b/Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-stderr.txt new file mode 100644 index 0000000..f2cbaa6 --- /dev/null +++ b/Tests/RunCMake/CommandLine/BuildDir--build-multiple-targets-stderr.txt @@ -0,0 +1,3 @@ +^'--target' may not be specified more than once\. ++ +Usage: cmake --build <dir> \[options\] \[-- \[native-options\]\] diff --git a/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt b/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt index 20df108..d2a2831 100644 --- a/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt +++ b/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt @@ -3,3 +3,5 @@ add_custom_command( COMMAND ${CMAKE_COMMAND} -E echo CustomCommand > output.txt ) add_custom_target(CustomTarget ALL DEPENDS output.txt) +add_custom_target(CustomTarget2 ALL DEPENDS output.txt) +add_custom_target(CustomTarget3 ALL DEPENDS output.txt) diff --git a/Tests/RunCMake/CommandLine/DeprecateVS6-WARN-ON-stderr.txt b/Tests/RunCMake/CommandLine/DeprecateVS6-WARN-ON-stderr.txt deleted file mode 100644 index 1b6a510..0000000 --- a/Tests/RunCMake/CommandLine/DeprecateVS6-WARN-ON-stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -^CMake Warning: - The "Visual Studio 6" generator is deprecated and will be removed in a - future version of CMake. - - Add CMAKE_WARN_VS6=OFF to the cache to disable this warning.$ diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index e3b73ff..3b5504e 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -51,6 +51,8 @@ function(run_BuildDir) run_cmake(BuildDir) run_cmake_command(BuildDir--build ${CMAKE_COMMAND} -E chdir .. ${CMAKE_COMMAND} --build BuildDir-build --target CustomTarget) + run_cmake_command(BuildDir--build-multiple-targets ${CMAKE_COMMAND} -E chdir .. + ${CMAKE_COMMAND} --build BuildDir-build --target CustomTarget2 --target CustomTarget3) endfunction() run_BuildDir() @@ -70,12 +72,7 @@ if(RunCMake_GENERATOR STREQUAL "Ninja") unset(RunCMake_TEST_NO_CLEAN) endif() -if(RunCMake_GENERATOR STREQUAL "Visual Studio 6") - set(RunCMake_WARN_VS6 1) - run_cmake(DeprecateVS6-WARN-ON) - unset(RunCMake_WARN_VS6) - run_cmake(DeprecateVS6-WARN-OFF) -elseif(RunCMake_GENERATOR STREQUAL "Visual Studio 7") +if(RunCMake_GENERATOR STREQUAL "Visual Studio 7") set(RunCMake_WARN_VS70 1) run_cmake(DeprecateVS70-WARN-ON) unset(RunCMake_WARN_VS70) diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake index 64f97bc..4e06888 100644 --- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake +++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake @@ -16,3 +16,19 @@ run_CMP0058(WARN-no) run_CMP0058(WARN-by) run_CMP0058(NEW-no) run_CMP0058(NEW-by) + +function(run_SubDir) + # Use a single build tree for a few tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/SubDir-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(SubDir) + if(WIN32) + set(SubDir_all [[SubDir\all]]) + else() + set(SubDir_all [[SubDir/all]]) + endif() + run_cmake_command(SubDir-build ${CMAKE_COMMAND} --build . --target ${SubDir_all}) +endfunction() +run_SubDir() diff --git a/Tests/RunCMake/Ninja/SubDir-build-stdout.txt b/Tests/RunCMake/Ninja/SubDir-build-stdout.txt new file mode 100644 index 0000000..e4b4662 --- /dev/null +++ b/Tests/RunCMake/Ninja/SubDir-build-stdout.txt @@ -0,0 +1 @@ +Building InAll diff --git a/Tests/RunCMake/Ninja/SubDir.cmake b/Tests/RunCMake/Ninja/SubDir.cmake new file mode 100644 index 0000000..7224ec3 --- /dev/null +++ b/Tests/RunCMake/Ninja/SubDir.cmake @@ -0,0 +1,2 @@ +add_subdirectory(SubDir) +add_custom_target(TopFail ALL COMMAND does_not_exist) diff --git a/Tests/RunCMake/Ninja/SubDir/CMakeLists.txt b/Tests/RunCMake/Ninja/SubDir/CMakeLists.txt new file mode 100644 index 0000000..73ae431 --- /dev/null +++ b/Tests/RunCMake/Ninja/SubDir/CMakeLists.txt @@ -0,0 +1,2 @@ +add_custom_target(SubFail COMMAND does_not_exist) +add_custom_target(InAll ALL COMMAND ${CMAKE_COMMAND} -E echo "Building InAll") diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index db9911d..9d44a8a 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -51,9 +51,6 @@ function(run_cmake test) if(APPLE) list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0025=NEW) endif() - if(RunCMake_GENERATOR STREQUAL "Visual Studio 6" AND NOT RunCMake_WARN_VS6) - list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_WARN_VS6=OFF) - endif() if(RunCMake_GENERATOR STREQUAL "Visual Studio 7" AND NOT RunCMake_WARN_VS70) list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_WARN_VS70=OFF) endif() diff --git a/Tests/RunCMake/ToolchainFile/CMakeLists.txt b/Tests/RunCMake/ToolchainFile/CMakeLists.txt new file mode 100644 index 0000000..93ee9df --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.5) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/ToolchainFile/CallEnableLanguage-result.txt b/Tests/RunCMake/ToolchainFile/CallEnableLanguage-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CallEnableLanguage-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ToolchainFile/CallEnableLanguage-stderr.txt b/Tests/RunCMake/ToolchainFile/CallEnableLanguage-stderr.txt new file mode 100644 index 0000000..0de51c6 --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CallEnableLanguage-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at CallEnableLanguage-toolchain.cmake:[0-9]+ \(enable_language\): + Language 'NONE' is currently being enabled. Recursive call not allowed. +Call Stack \(most recent call first\): + .*/Modules/CMakeDetermineSystem.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(project\)$ diff --git a/Tests/RunCMake/ToolchainFile/CallEnableLanguage-toolchain.cmake b/Tests/RunCMake/ToolchainFile/CallEnableLanguage-toolchain.cmake new file mode 100644 index 0000000..8145101 --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CallEnableLanguage-toolchain.cmake @@ -0,0 +1 @@ +enable_language(NONE) diff --git a/Tests/RunCMake/ToolchainFile/CallEnableLanguage.cmake b/Tests/RunCMake/ToolchainFile/CallEnableLanguage.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CallEnableLanguage.cmake diff --git a/Tests/RunCMake/ToolchainFile/CallProject-result.txt b/Tests/RunCMake/ToolchainFile/CallProject-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CallProject-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ToolchainFile/CallProject-stderr.txt b/Tests/RunCMake/ToolchainFile/CallProject-stderr.txt new file mode 100644 index 0000000..e2b9f1b --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CallProject-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at CallProject-toolchain.cmake:[0-9]+ \(project\): + Language 'NONE' is currently being enabled. Recursive call not allowed. +Call Stack \(most recent call first\): + .*/Modules/CMakeDetermineSystem.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(project\)$ diff --git a/Tests/RunCMake/ToolchainFile/CallProject-toolchain.cmake b/Tests/RunCMake/ToolchainFile/CallProject-toolchain.cmake new file mode 100644 index 0000000..b113c13 --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CallProject-toolchain.cmake @@ -0,0 +1 @@ +project(Bad NONE) diff --git a/Tests/RunCMake/ToolchainFile/CallProject.cmake b/Tests/RunCMake/ToolchainFile/CallProject.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CallProject.cmake diff --git a/Tests/RunCMake/ToolchainFile/RunCMakeTest.cmake b/Tests/RunCMake/ToolchainFile/RunCMakeTest.cmake new file mode 100644 index 0000000..75293e7 --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/RunCMakeTest.cmake @@ -0,0 +1,9 @@ +include(RunCMake) + +function(run_cmake_toolchain t) + set(RunCMake_TEST_OPTIONS -DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/${t}-toolchain.cmake) + run_cmake(${t}) +endfunction() + +run_cmake_toolchain(CallEnableLanguage) +run_cmake_toolchain(CallProject) diff --git a/Tests/RunCMake/VS10Project/CMakeLists.txt b/Tests/RunCMake/VS10Project/CMakeLists.txt new file mode 100644 index 0000000..91baae7 --- /dev/null +++ b/Tests/RunCMake/VS10Project/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.5.0) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake new file mode 100644 index 0000000..cc2cc2e --- /dev/null +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -0,0 +1,2 @@ +include(RunCMake) +run_cmake(VsConfigurationType) diff --git a/Tests/RunCMake/VS10Project/VsConfigurationType-check.cmake b/Tests/RunCMake/VS10Project/VsConfigurationType-check.cmake new file mode 100644 index 0000000..4690970 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsConfigurationType-check.cmake @@ -0,0 +1,24 @@ +set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") +if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() +endif() + +set(propertyFound FALSE) +file(STRINGS "${vcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "^ *<ConfigurationType>(.*)</ConfigurationType>$") + set(propertyFound TRUE) + set(expectedValue "MyValue") + set(actualValue ${CMAKE_MATCH_1}) + if(NOT (${actualValue} STREQUAL ${expectedValue})) + set(RunCMake_TEST_FAILED "ConfigurationType \"${actualValue}\" differs from expected value \"${expectedValue}\".") + return() + endif() + endif() +endforeach() + +if(NOT propertyFound) + set(RunCMake_TEST_FAILED "Property ConfigurationType not found in project file.") + return() +endif() diff --git a/Tests/RunCMake/VS10Project/VsConfigurationType.cmake b/Tests/RunCMake/VS10Project/VsConfigurationType.cmake new file mode 100644 index 0000000..a73dfe8 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsConfigurationType.cmake @@ -0,0 +1,3 @@ +enable_language(CXX) +add_library(foo foo.cpp) +set_target_properties(foo PROPERTIES VS_CONFIGURATION_TYPE "MyValue") diff --git a/Tests/RunCMake/VS10Project/foo.cpp b/Tests/RunCMake/VS10Project/foo.cpp new file mode 100644 index 0000000..2fb55ee --- /dev/null +++ b/Tests/RunCMake/VS10Project/foo.cpp @@ -0,0 +1 @@ +void foo() { } diff --git a/Tests/RunCMake/SolutionGlobalSections/CMakeLists.txt b/Tests/RunCMake/VSSolution/CMakeLists.txt index 12cd3c7..12cd3c7 100644 --- a/Tests/RunCMake/SolutionGlobalSections/CMakeLists.txt +++ b/Tests/RunCMake/VSSolution/CMakeLists.txt diff --git a/Tests/RunCMake/SolutionGlobalSections/MorePost-check.cmake b/Tests/RunCMake/VSSolution/MorePost-check.cmake index 0f7e370..0f7e370 100644 --- a/Tests/RunCMake/SolutionGlobalSections/MorePost-check.cmake +++ b/Tests/RunCMake/VSSolution/MorePost-check.cmake diff --git a/Tests/RunCMake/SolutionGlobalSections/MorePost.cmake b/Tests/RunCMake/VSSolution/MorePost.cmake index 2eb3f60..2eb3f60 100644 --- a/Tests/RunCMake/SolutionGlobalSections/MorePost.cmake +++ b/Tests/RunCMake/VSSolution/MorePost.cmake diff --git a/Tests/RunCMake/SolutionGlobalSections/MorePre-check.cmake b/Tests/RunCMake/VSSolution/MorePre-check.cmake index 45e7419..45e7419 100644 --- a/Tests/RunCMake/SolutionGlobalSections/MorePre-check.cmake +++ b/Tests/RunCMake/VSSolution/MorePre-check.cmake diff --git a/Tests/RunCMake/SolutionGlobalSections/MorePre.cmake b/Tests/RunCMake/VSSolution/MorePre.cmake index 07f4eb8..07f4eb8 100644 --- a/Tests/RunCMake/SolutionGlobalSections/MorePre.cmake +++ b/Tests/RunCMake/VSSolution/MorePre.cmake diff --git a/Tests/RunCMake/SolutionGlobalSections/OnePost-check.cmake b/Tests/RunCMake/VSSolution/OnePost-check.cmake index 6af5156..6af5156 100644 --- a/Tests/RunCMake/SolutionGlobalSections/OnePost-check.cmake +++ b/Tests/RunCMake/VSSolution/OnePost-check.cmake diff --git a/Tests/RunCMake/SolutionGlobalSections/OnePost.cmake b/Tests/RunCMake/VSSolution/OnePost.cmake index 2295cfb..2295cfb 100644 --- a/Tests/RunCMake/SolutionGlobalSections/OnePost.cmake +++ b/Tests/RunCMake/VSSolution/OnePost.cmake diff --git a/Tests/RunCMake/SolutionGlobalSections/OnePre-check.cmake b/Tests/RunCMake/VSSolution/OnePre-check.cmake index 70b18b2..70b18b2 100644 --- a/Tests/RunCMake/SolutionGlobalSections/OnePre-check.cmake +++ b/Tests/RunCMake/VSSolution/OnePre-check.cmake diff --git a/Tests/RunCMake/SolutionGlobalSections/OnePre.cmake b/Tests/RunCMake/VSSolution/OnePre.cmake index 1499b47..1499b47 100644 --- a/Tests/RunCMake/SolutionGlobalSections/OnePre.cmake +++ b/Tests/RunCMake/VSSolution/OnePre.cmake diff --git a/Tests/RunCMake/SolutionGlobalSections/Override1-check.cmake b/Tests/RunCMake/VSSolution/Override1-check.cmake index a19e2e1..a19e2e1 100644 --- a/Tests/RunCMake/SolutionGlobalSections/Override1-check.cmake +++ b/Tests/RunCMake/VSSolution/Override1-check.cmake diff --git a/Tests/RunCMake/SolutionGlobalSections/Override1.cmake b/Tests/RunCMake/VSSolution/Override1.cmake index a726c9f..a726c9f 100644 --- a/Tests/RunCMake/SolutionGlobalSections/Override1.cmake +++ b/Tests/RunCMake/VSSolution/Override1.cmake diff --git a/Tests/RunCMake/SolutionGlobalSections/Override2-check.cmake b/Tests/RunCMake/VSSolution/Override2-check.cmake index d9656e1..d9656e1 100644 --- a/Tests/RunCMake/SolutionGlobalSections/Override2-check.cmake +++ b/Tests/RunCMake/VSSolution/Override2-check.cmake diff --git a/Tests/RunCMake/SolutionGlobalSections/Override2.cmake b/Tests/RunCMake/VSSolution/Override2.cmake index 0ce43cc..0ce43cc 100644 --- a/Tests/RunCMake/SolutionGlobalSections/Override2.cmake +++ b/Tests/RunCMake/VSSolution/Override2.cmake diff --git a/Tests/RunCMake/SolutionGlobalSections/PrePost-check.cmake b/Tests/RunCMake/VSSolution/PrePost-check.cmake index 322a689..322a689 100644 --- a/Tests/RunCMake/SolutionGlobalSections/PrePost-check.cmake +++ b/Tests/RunCMake/VSSolution/PrePost-check.cmake diff --git a/Tests/RunCMake/SolutionGlobalSections/PrePost.cmake b/Tests/RunCMake/VSSolution/PrePost.cmake index 976c341..976c341 100644 --- a/Tests/RunCMake/SolutionGlobalSections/PrePost.cmake +++ b/Tests/RunCMake/VSSolution/PrePost.cmake diff --git a/Tests/RunCMake/SolutionGlobalSections/RunCMakeTest.cmake b/Tests/RunCMake/VSSolution/RunCMakeTest.cmake index 6ae158d..afd74a1 100644 --- a/Tests/RunCMake/SolutionGlobalSections/RunCMakeTest.cmake +++ b/Tests/RunCMake/VSSolution/RunCMakeTest.cmake @@ -8,3 +8,9 @@ run_cmake(MorePost) run_cmake(PrePost) run_cmake(Override1) run_cmake(Override2) +run_cmake(StartupProject) +run_cmake(StartupProjectMissing) + +if(RunCMake_GENERATOR MATCHES "Visual Studio ([^7]|[7][0-9])" AND NOT NO_USE_FOLDERS) + run_cmake(StartupProjectUseFolders) +endif() diff --git a/Tests/RunCMake/VSSolution/StartupProject-check.cmake b/Tests/RunCMake/VSSolution/StartupProject-check.cmake new file mode 100644 index 0000000..f36aab2 --- /dev/null +++ b/Tests/RunCMake/VSSolution/StartupProject-check.cmake @@ -0,0 +1,5 @@ +getProjectNames(projects) +list(GET projects 0 first_project) +if(NOT first_project STREQUAL "TestStartup") + error("TestStartup is not the startup project") +endif() diff --git a/Tests/RunCMake/VSSolution/StartupProject.cmake b/Tests/RunCMake/VSSolution/StartupProject.cmake new file mode 100644 index 0000000..7192f3d --- /dev/null +++ b/Tests/RunCMake/VSSolution/StartupProject.cmake @@ -0,0 +1,2 @@ +add_custom_target(TestStartup) +set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT "TestStartup") diff --git a/Tests/RunCMake/VSSolution/StartupProjectMissing-check.cmake b/Tests/RunCMake/VSSolution/StartupProjectMissing-check.cmake new file mode 100644 index 0000000..b1017dd --- /dev/null +++ b/Tests/RunCMake/VSSolution/StartupProjectMissing-check.cmake @@ -0,0 +1,5 @@ +getProjectNames(projects) +list(GET projects 0 first_project) +if(NOT first_project STREQUAL "ALL_BUILD") + error("ALL_BUILD is not the startup project") +endif() diff --git a/Tests/RunCMake/VSSolution/StartupProjectMissing-stderr.txt b/Tests/RunCMake/VSSolution/StartupProjectMissing-stderr.txt new file mode 100644 index 0000000..da92c6d --- /dev/null +++ b/Tests/RunCMake/VSSolution/StartupProjectMissing-stderr.txt @@ -0,0 +1,4 @@ +^CMake Warning \(dev\) in CMakeLists.txt: + Directory property VS_STARTUP_PROJECT specifies target 'DoesNotExist' that + does not exist. Ignoring. +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/VSSolution/StartupProjectMissing.cmake b/Tests/RunCMake/VSSolution/StartupProjectMissing.cmake new file mode 100644 index 0000000..907a877 --- /dev/null +++ b/Tests/RunCMake/VSSolution/StartupProjectMissing.cmake @@ -0,0 +1 @@ +set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT "DoesNotExist") diff --git a/Tests/RunCMake/VSSolution/StartupProjectUseFolders-check.cmake b/Tests/RunCMake/VSSolution/StartupProjectUseFolders-check.cmake new file mode 100644 index 0000000..c0a545a --- /dev/null +++ b/Tests/RunCMake/VSSolution/StartupProjectUseFolders-check.cmake @@ -0,0 +1,9 @@ +getProjectNames(projects) +list(GET projects 0 first_project) +if(NOT first_project STREQUAL "CMakePredefinedTargets") + error("CMakePredefinedTargets is not the first project") +endif() +list(GET projects 1 second_project) +if(NOT second_project STREQUAL "TestStartup") + error("TestStartup does not immediately follow the CMakePredefinedTargets project") +endif() diff --git a/Tests/RunCMake/VSSolution/StartupProjectUseFolders.cmake b/Tests/RunCMake/VSSolution/StartupProjectUseFolders.cmake new file mode 100644 index 0000000..8e422a4 --- /dev/null +++ b/Tests/RunCMake/VSSolution/StartupProjectUseFolders.cmake @@ -0,0 +1,3 @@ +add_custom_target(TestStartup) +set_property(GLOBAL PROPERTY USE_FOLDERS ON) +set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT "TestStartup") diff --git a/Tests/RunCMake/SolutionGlobalSections/solution_parsing.cmake b/Tests/RunCMake/VSSolution/solution_parsing.cmake index dd158ef..4e5bb59 100644 --- a/Tests/RunCMake/SolutionGlobalSections/solution_parsing.cmake +++ b/Tests/RunCMake/VSSolution/solution_parsing.cmake @@ -50,6 +50,21 @@ macro(parseGlobalSections arg_out_pre arg_out_post testName) endmacro() +macro(getProjectNames arg_out_projects) + set(${arg_out_projects} "") + set(sln "${RunCMake_TEST_BINARY_DIR}/${test}.sln") + if(NOT EXISTS "${sln}") + error("Expected solution file ${sln} does not exist") + endif() + file(STRINGS "${sln}" project_lines REGEX "^Project\\(") + foreach(project_line IN LISTS project_lines) + string(REGEX REPLACE ".* = \"" "" project_line "${project_line}") + string(REGEX REPLACE "\", .*" "" project_line "${project_line}") + list(APPEND ${arg_out_projects} "${project_line}") + endforeach() +endmacro() + + macro(testGlobalSection prefix sectionName) if(NOT DEFINED ${prefix}_${sectionName}) error("Section ${sectionName} does not exist") diff --git a/Tests/RunCMake/cmake_parse_arguments/CornerCases.cmake b/Tests/RunCMake/cmake_parse_arguments/CornerCases.cmake index 72c82ab..028bfaf 100644 --- a/Tests/RunCMake/cmake_parse_arguments/CornerCases.cmake +++ b/Tests/RunCMake/cmake_parse_arguments/CornerCases.cmake @@ -29,6 +29,26 @@ macro(foo) endmacro() foo(FOO foo) +TEST(_FOO1_FOO foo) +TEST(_FOO2_FOO foo) +# Make sure a list is split +foo(FOO "foo;bar") TEST(_FOO1_FOO foo) +TEST(_FOO1_UNPARSED_ARGUMENTS "bar") TEST(_FOO2_FOO foo) +TEST(_FOO2_UNPARSED_ARGUMENTS "bar") + +# Do not split if argn is quoted +foo(FOO "foo\\;bar") +TEST(_FOO1_FOO foo) +TEST(_FOO1_UNPARSED_ARGUMENTS "bar") +TEST(_FOO2_FOO foo;bar) +TEST(_FOO2_UNPARSED_ARGUMENTS "UNDEFINED") + +# Do not split if argn is quoted +foo(FOO "foo\\\\;bar") +TEST(_FOO1_FOO foo) +TEST(_FOO1_UNPARSED_ARGUMENTS "bar") +TEST(_FOO2_FOO foo;bar) +TEST(_FOO2_UNPARSED_ARGUMENTS "UNDEFINED") diff --git a/Tests/RunCMake/cmake_parse_arguments/Initialization.cmake b/Tests/RunCMake/cmake_parse_arguments/Initialization.cmake index 462f923..b4199ea 100644 --- a/Tests/RunCMake/cmake_parse_arguments/Initialization.cmake +++ b/Tests/RunCMake/cmake_parse_arguments/Initialization.cmake @@ -25,6 +25,9 @@ TEST(pref_OPT1 TRUE) cmake_parse_arguments(pref "OPT1;OPT2" "" "" OPT1 OPT2) TEST(pref_OPT1 TRUE) TEST(pref_OPT2 TRUE) +cmake_parse_arguments(pref "OPT1;OPT2" "" "" "OPT1;OPT2") +TEST(pref_OPT1 TRUE) +TEST(pref_OPT2 TRUE) cmake_parse_arguments(pref "OPT1;OPT2" "" "") TEST(pref_OPT1 FALSE) TEST(pref_OPT2 FALSE) @@ -44,6 +47,9 @@ TEST(pref_SINGLE1 foo) cmake_parse_arguments(pref "" "SINGLE1;SINGLE2" "" SINGLE1 foo SINGLE2 bar) TEST(pref_SINGLE1 foo) TEST(pref_SINGLE2 bar) +cmake_parse_arguments(pref "" "SINGLE1;SINGLE2" "" "SINGLE1;foo;SINGLE2;bar") +TEST(pref_SINGLE1 foo) +TEST(pref_SINGLE2 bar) cmake_parse_arguments(pref "" "SINGLE1;SINGLE2" "") TEST(pref_SINGLE1 UNDEFINED) TEST(pref_SINGLE2 UNDEFINED) @@ -63,6 +69,9 @@ TEST(pref_MULTI1 foo) cmake_parse_arguments(pref "" "" "MULTI1;MULTI2" MULTI1 foo bar MULTI2 bar foo) TEST(pref_MULTI1 foo bar) TEST(pref_MULTI2 bar foo) +cmake_parse_arguments(pref "" "" "MULTI1;MULTI2" "MULTI1;foo;bar;MULTI2;bar;foo") +TEST(pref_MULTI1 foo bar) +TEST(pref_MULTI2 bar foo) cmake_parse_arguments(pref "" "" "MULTI1;MULTI2") TEST(pref_MULTI1 UNDEFINED) TEST(pref_MULTI2 UNDEFINED) diff --git a/Tests/RunCMake/file/DOWNLOAD-hash-mismatch-result.txt b/Tests/RunCMake/file/DOWNLOAD-hash-mismatch-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-hash-mismatch-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/DOWNLOAD-hash-mismatch-stderr.txt b/Tests/RunCMake/file/DOWNLOAD-hash-mismatch-stderr.txt new file mode 100644 index 0000000..406e315 --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-hash-mismatch-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at DOWNLOAD-hash-mismatch.cmake:[0-9]+ \(file\): + file DOWNLOAD HASH mismatch + + for file: \[.*/Tests/RunCMake/file/DOWNLOAD-hash-mismatch-build/hash-mismatch.txt\] + expected hash: \[0123456789abcdef0123456789abcdef01234567\] + actual hash: \[da39a3ee5e6b4b0d3255bfef95601890afd80709\] + status: \[0;"No error"\] + +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) ++ +status='1;HASH mismatch: expected: 0123456789abcdef0123456789abcdef01234567 actual: da39a3ee5e6b4b0d3255bfef95601890afd80709'$ diff --git a/Tests/RunCMake/file/DOWNLOAD-hash-mismatch.cmake b/Tests/RunCMake/file/DOWNLOAD-hash-mismatch.cmake new file mode 100644 index 0000000..ca72692 --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-hash-mismatch.cmake @@ -0,0 +1,7 @@ +file(DOWNLOAD + "file://${CMAKE_CURRENT_SOURCE_DIR}/DOWNLOAD-hash-mismatch.txt" + ${CMAKE_CURRENT_BINARY_DIR}/hash-mismatch.txt + EXPECTED_HASH SHA1=0123456789abcdef0123456789abcdef01234567 + STATUS status + ) +message("status='${status}'") diff --git a/Tests/RunCMake/file/DOWNLOAD-hash-mismatch.txt b/Tests/RunCMake/file/DOWNLOAD-hash-mismatch.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-hash-mismatch.txt diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake index d3dfb1b..5f85bba 100644 --- a/Tests/RunCMake/file/RunCMakeTest.cmake +++ b/Tests/RunCMake/file/RunCMakeTest.cmake @@ -1,5 +1,6 @@ include(RunCMake) +run_cmake(DOWNLOAD-hash-mismatch) run_cmake(INSTALL-DIRECTORY) run_cmake(INSTALL-MESSAGE-bad) run_cmake(FileOpenFailRead) diff --git a/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL-all-check.cmake b/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL-all-check.cmake new file mode 100644 index 0000000..0368df1 --- /dev/null +++ b/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^src-all;src-all/main\.c$]]) diff --git a/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL-exc-check.cmake b/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL-exc-check.cmake new file mode 100644 index 0000000..41a816f --- /dev/null +++ b/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL-exc-check.cmake @@ -0,0 +1 @@ +check_installed([[^src-exc;src-exc/main\.c$]]) diff --git a/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL-uns-check.cmake b/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL-uns-check.cmake new file mode 100644 index 0000000..68a1378 --- /dev/null +++ b/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL-uns-check.cmake @@ -0,0 +1 @@ +check_installed([[^src-all;src-all/main\.c;src-uns;src-uns/main\.c$]]) diff --git a/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL.cmake b/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL.cmake new file mode 100644 index 0000000..720299b --- /dev/null +++ b/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL.cmake @@ -0,0 +1,3 @@ +install(FILES main.c DESTINATION src-all) +install(FILES main.c DESTINATION src-uns EXCLUDE_FROM_ALL) +install(FILES main.c DESTINATION src-exc EXCLUDE_FROM_ALL COMPONENT exc) diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index c2347d8..45693b5 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -1,4 +1,46 @@ +cmake_minimum_required(VERSION 3.4) include(RunCMake) + +# Function to build and install a project. The latter step *-check.cmake +# scripts can check installed files using the check_installed function. +function(run_install_test case) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-build) + set(RunCMake_TEST_NO_CLEAN 1) + 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) + # Check "all" components. + set(CMAKE_INSTALL_PREFIX ${RunCMake_TEST_BINARY_DIR}/root-all) + run_cmake_command(${case}-all ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_TYPE=Debug -P cmake_install.cmake) + # Check unspecified component. + set(CMAKE_INSTALL_PREFIX ${RunCMake_TEST_BINARY_DIR}/root-uns) + run_cmake_command(${case}-uns ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_TYPE=Debug -DCOMPONENT=Unspecified -P cmake_install.cmake) + # Check explicit component. + set(CMAKE_INSTALL_PREFIX ${RunCMake_TEST_BINARY_DIR}/root-exc) + run_cmake_command(${case}-exc ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_TYPE=Debug -DCOMPONENT=exc -P cmake_install.cmake) +endfunction() + +# Function called in *-check.cmake scripts to check installed files. +function(check_installed expect) + file(GLOB_RECURSE actual + LIST_DIRECTORIES TRUE + RELATIVE ${CMAKE_INSTALL_PREFIX} + ${CMAKE_INSTALL_PREFIX}/* + ) + if(actual) + list(SORT actual) + endif() + if(NOT "${actual}" MATCHES "${expect}") + set(RunCMake_TEST_FAILED "Installed files: + ${actual} +do not match what we expected: + ${expect} +in directory: + ${CMAKE_INSTALL_PREFIX}" PARENT_SCOPE) + endif() +endfunction() + run_cmake(DIRECTORY-MESSAGE_NEVER) run_cmake(DIRECTORY-PATTERN-MESSAGE_NEVER) run_cmake(DIRECTORY-message) @@ -14,3 +56,6 @@ run_cmake(EXPORT-OldIFace) run_cmake(CMP0062-OLD) run_cmake(CMP0062-NEW) run_cmake(CMP0062-WARN) + +run_install_test(FILES-EXCLUDE_FROM_ALL) +run_install_test(TARGETS-EXCLUDE_FROM_ALL) diff --git a/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL-all-check.cmake b/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL-all-check.cmake new file mode 100644 index 0000000..9b538bb --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^bin-all;bin-all/myexe(\.exe)?$]]) diff --git a/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL-exc-check.cmake b/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL-exc-check.cmake new file mode 100644 index 0000000..aef0d27 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL-exc-check.cmake @@ -0,0 +1 @@ +check_installed([[^bin-exc;bin-exc/myexe(\.exe)?$]]) diff --git a/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL-uns-check.cmake b/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL-uns-check.cmake new file mode 100644 index 0000000..56fd264 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL-uns-check.cmake @@ -0,0 +1 @@ +check_installed([[^bin-all;bin-all/myexe(\.exe)?;bin-uns;bin-uns/myexe(\.exe)?$]]) diff --git a/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL.cmake b/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL.cmake new file mode 100644 index 0000000..6fb2036 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL.cmake @@ -0,0 +1,5 @@ +enable_language(C) +add_executable(myexe main.c) +install(TARGETS myexe DESTINATION bin-all) +install(TARGETS myexe DESTINATION bin-uns EXCLUDE_FROM_ALL) +install(TARGETS myexe DESTINATION bin-exc EXCLUDE_FROM_ALL COMPONENT exc) diff --git a/Tests/RunCMake/install/main.c b/Tests/RunCMake/install/main.c new file mode 100644 index 0000000..78f2de1 --- /dev/null +++ b/Tests/RunCMake/install/main.c @@ -0,0 +1 @@ +int main(void) { return 0; } diff --git a/Tests/RunCMake/list/EmptyFilterRegex-result.txt b/Tests/RunCMake/list/EmptyFilterRegex-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/list/EmptyFilterRegex-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/list/EmptyFilterRegex-stderr.txt b/Tests/RunCMake/list/EmptyFilterRegex-stderr.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/list/EmptyFilterRegex-stderr.txt diff --git a/Tests/RunCMake/list/EmptyFilterRegex.cmake b/Tests/RunCMake/list/EmptyFilterRegex.cmake new file mode 100644 index 0000000..33849cd --- /dev/null +++ b/Tests/RunCMake/list/EmptyFilterRegex.cmake @@ -0,0 +1,2 @@ +set(mylist "") +list(FILTER mylist INCLUDE REGEX "^FILTER_THIS_.+") diff --git a/Tests/RunCMake/list/FILTER-NotList-result.txt b/Tests/RunCMake/list/FILTER-NotList-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/FILTER-NotList-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/FILTER-NotList-stderr.txt b/Tests/RunCMake/list/FILTER-NotList-stderr.txt new file mode 100644 index 0000000..159c28d --- /dev/null +++ b/Tests/RunCMake/list/FILTER-NotList-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at FILTER-NotList.cmake:2 \(list\): + list sub-command FILTER requires list to be present. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/FILTER-NotList.cmake b/Tests/RunCMake/list/FILTER-NotList.cmake new file mode 100644 index 0000000..1e15635 --- /dev/null +++ b/Tests/RunCMake/list/FILTER-NotList.cmake @@ -0,0 +1,2 @@ +unset(nosuchlist) +list(FILTER nosuchlist EXCLUDE REGEX "^FILTER_THIS_.+") diff --git a/Tests/RunCMake/list/FILTER-REGEX-InvalidMode-result.txt b/Tests/RunCMake/list/FILTER-REGEX-InvalidMode-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-InvalidMode-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/FILTER-REGEX-InvalidMode-stderr.txt b/Tests/RunCMake/list/FILTER-REGEX-InvalidMode-stderr.txt new file mode 100644 index 0000000..7f783fa --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-InvalidMode-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at FILTER-REGEX-InvalidMode.cmake:2 \(list\): + list sub-command FILTER does not recognize mode NOOP +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/FILTER-REGEX-InvalidMode.cmake b/Tests/RunCMake/list/FILTER-REGEX-InvalidMode.cmake new file mode 100644 index 0000000..e02b929 --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-InvalidMode.cmake @@ -0,0 +1,2 @@ +set(mylist FILTER_THIS_BIT DO_NOT_FILTER_THIS thisisanitem FILTER_THIS_THING) +list(FILTER mylist EXCLUDE NOOP "^FILTER_THIS_.+") diff --git a/Tests/RunCMake/list/FILTER-REGEX-InvalidOperator-result.txt b/Tests/RunCMake/list/FILTER-REGEX-InvalidOperator-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-InvalidOperator-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/FILTER-REGEX-InvalidOperator-stderr.txt b/Tests/RunCMake/list/FILTER-REGEX-InvalidOperator-stderr.txt new file mode 100644 index 0000000..94f2427 --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-InvalidOperator-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at FILTER-REGEX-InvalidOperator.cmake:2 \(list\): + list sub-command FILTER does not recognize operator RM +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/FILTER-REGEX-InvalidOperator.cmake b/Tests/RunCMake/list/FILTER-REGEX-InvalidOperator.cmake new file mode 100644 index 0000000..9624622 --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-InvalidOperator.cmake @@ -0,0 +1,2 @@ +set(mylist FILTER_THIS_BIT DO_NOT_FILTER_THIS thisisanitem FILTER_THIS_THING) +list(FILTER mylist RM REGEX "^FILTER_THIS_.+") diff --git a/Tests/RunCMake/list/FILTER-REGEX-InvalidRegex-result.txt b/Tests/RunCMake/list/FILTER-REGEX-InvalidRegex-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-InvalidRegex-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/FILTER-REGEX-InvalidRegex-stderr.txt b/Tests/RunCMake/list/FILTER-REGEX-InvalidRegex-stderr.txt new file mode 100644 index 0000000..9e98cbf --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-InvalidRegex-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at FILTER-REGEX-InvalidRegex.cmake:2 \(list\): + list sub-command FILTER, mode REGEX failed to compile regex "UHOH!\)\(". +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/FILTER-REGEX-InvalidRegex.cmake b/Tests/RunCMake/list/FILTER-REGEX-InvalidRegex.cmake new file mode 100644 index 0000000..0641062 --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-InvalidRegex.cmake @@ -0,0 +1,2 @@ +set(mylist FILTER_THIS_BIT DO_NOT_FILTER_THIS thisisanitem FILTER_THIS_THING) +list(FILTER mylist EXCLUDE REGEX "UHOH!)(") diff --git a/Tests/RunCMake/list/FILTER-REGEX-TooManyArguments-result.txt b/Tests/RunCMake/list/FILTER-REGEX-TooManyArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-TooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/FILTER-REGEX-TooManyArguments-stderr.txt b/Tests/RunCMake/list/FILTER-REGEX-TooManyArguments-stderr.txt new file mode 100644 index 0000000..ec7f41c --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-TooManyArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at FILTER-REGEX-TooManyArguments.cmake:2 \(list\): + list sub-command FILTER, mode REGEX requires five arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/FILTER-REGEX-TooManyArguments.cmake b/Tests/RunCMake/list/FILTER-REGEX-TooManyArguments.cmake new file mode 100644 index 0000000..d9cd8eb --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-TooManyArguments.cmake @@ -0,0 +1,2 @@ +set(mylist FILTER_THIS_BIT DO_NOT_FILTER_THIS thisisanitem FILTER_THIS_THING) +list(FILTER mylist EXCLUDE REGEX "^FILTER_THIS_.+" one_too_many) diff --git a/Tests/RunCMake/list/FILTER-REGEX-Valid0-result.txt b/Tests/RunCMake/list/FILTER-REGEX-Valid0-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-Valid0-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/list/FILTER-REGEX-Valid0-stderr.txt b/Tests/RunCMake/list/FILTER-REGEX-Valid0-stderr.txt new file mode 100644 index 0000000..d9ba38d --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-Valid0-stderr.txt @@ -0,0 +1,2 @@ +^mylist was: FILTER_THIS_BIT;DO_NOT_FILTER_THIS;thisisanitem;FILTER_THIS_THING +mylist is: DO_NOT_FILTER_THIS;thisisanitem$ diff --git a/Tests/RunCMake/list/FILTER-REGEX-Valid0.cmake b/Tests/RunCMake/list/FILTER-REGEX-Valid0.cmake new file mode 100644 index 0000000..f395e61 --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-Valid0.cmake @@ -0,0 +1,4 @@ +set(mylist FILTER_THIS_BIT DO_NOT_FILTER_THIS thisisanitem FILTER_THIS_THING) +message("mylist was: ${mylist}") +list(FILTER mylist EXCLUDE REGEX "^FILTER_THIS_.+") +message("mylist is: ${mylist}") diff --git a/Tests/RunCMake/list/FILTER-REGEX-Valid1-result.txt b/Tests/RunCMake/list/FILTER-REGEX-Valid1-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-Valid1-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/list/FILTER-REGEX-Valid1-stderr.txt b/Tests/RunCMake/list/FILTER-REGEX-Valid1-stderr.txt new file mode 100644 index 0000000..5e5280d --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-Valid1-stderr.txt @@ -0,0 +1,2 @@ +^mylist was: FILTER_THIS_BIT;DO_NOT_FILTER_THIS;thisisanitem;FILTER_THIS_THING +mylist is: FILTER_THIS_BIT;FILTER_THIS_THING$ diff --git a/Tests/RunCMake/list/FILTER-REGEX-Valid1.cmake b/Tests/RunCMake/list/FILTER-REGEX-Valid1.cmake new file mode 100644 index 0000000..e659281 --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-Valid1.cmake @@ -0,0 +1,4 @@ +set(mylist FILTER_THIS_BIT DO_NOT_FILTER_THIS thisisanitem FILTER_THIS_THING) +message("mylist was: ${mylist}") +list(FILTER mylist INCLUDE REGEX "^FILTER_THIS_.+") +message("mylist is: ${mylist}") diff --git a/Tests/RunCMake/list/RunCMakeTest.cmake b/Tests/RunCMake/list/RunCMakeTest.cmake index 25d6a03..b002ab3 100644 --- a/Tests/RunCMake/list/RunCMakeTest.cmake +++ b/Tests/RunCMake/list/RunCMakeTest.cmake @@ -1,5 +1,6 @@ include(RunCMake) +run_cmake(EmptyFilterRegex) run_cmake(EmptyGet0) run_cmake(EmptyRemoveAt0) run_cmake(EmptyInsert-1) @@ -8,17 +9,25 @@ run_cmake(NoArguments) run_cmake(InvalidSubcommand) run_cmake(GET-CMP0007-WARN) +run_cmake(FILTER-REGEX-InvalidRegex) run_cmake(GET-InvalidIndex) run_cmake(INSERT-InvalidIndex) run_cmake(REMOVE_AT-InvalidIndex) +run_cmake(FILTER-REGEX-TooManyArguments) run_cmake(LENGTH-TooManyArguments) run_cmake(REMOVE_DUPLICATES-TooManyArguments) run_cmake(REVERSE-TooManyArguments) run_cmake(SORT-TooManyArguments) +run_cmake(FILTER-NotList) run_cmake(REMOVE_AT-NotList) run_cmake(REMOVE_DUPLICATES-NotList) run_cmake(REMOVE_ITEM-NotList) run_cmake(REVERSE-NotList) run_cmake(SORT-NotList) + +run_cmake(FILTER-REGEX-InvalidMode) +run_cmake(FILTER-REGEX-InvalidOperator) +run_cmake(FILTER-REGEX-Valid0) +run_cmake(FILTER-REGEX-Valid1) diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake index 6cdbafa..43ce998 100644 --- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake +++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake @@ -16,6 +16,10 @@ run_cmake(BadSources2) run_cmake(NonSourceCopyFile) run_cmake(NonSourceCompileDefinitions) +run_cmake(TargetTypeExe) +run_cmake(TargetTypeInvalid) +run_cmake(TargetTypeStatic) + run_cmake(CMP0056) if(RunCMake_GENERATOR MATCHES "Make|Ninja") diff --git a/Tests/RunCMake/try_compile/TargetTypeExe.cmake b/Tests/RunCMake/try_compile/TargetTypeExe.cmake new file mode 100644 index 0000000..9b6e727 --- /dev/null +++ b/Tests/RunCMake/try_compile/TargetTypeExe.cmake @@ -0,0 +1,14 @@ +enable_language(C) +set(CMAKE_TRY_COMPILE_TARGET_TYPE EXECUTABLE) +try_compile(result ${CMAKE_CURRENT_BINARY_DIR} + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.c + OUTPUT_VARIABLE out + COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/copy + COPY_FILE_ERROR copy_err + ) +if(NOT result) + message(FATAL_ERROR "try_compile failed:\n${out}") +endif() +if(copy_err) + message(FATAL_ERROR "try_compile COPY_FILE failed:\n${copy_err}") +endif() diff --git a/Tests/RunCMake/try_compile/TargetTypeInvalid-result.txt b/Tests/RunCMake/try_compile/TargetTypeInvalid-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/TargetTypeInvalid-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/TargetTypeInvalid-stderr.txt b/Tests/RunCMake/try_compile/TargetTypeInvalid-stderr.txt new file mode 100644 index 0000000..08b281a --- /dev/null +++ b/Tests/RunCMake/try_compile/TargetTypeInvalid-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at TargetTypeInvalid.cmake:2 \(try_compile\): + Invalid value 'INVALID' for CMAKE_TRY_COMPILE_TARGET_TYPE. Only + 'EXECUTABLE' and 'STATIC_LIBRARY' are allowed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/TargetTypeInvalid.cmake b/Tests/RunCMake/try_compile/TargetTypeInvalid.cmake new file mode 100644 index 0000000..0bbc4ac --- /dev/null +++ b/Tests/RunCMake/try_compile/TargetTypeInvalid.cmake @@ -0,0 +1,2 @@ +set(CMAKE_TRY_COMPILE_TARGET_TYPE INVALID) +try_compile(result ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c) diff --git a/Tests/RunCMake/try_compile/TargetTypeStatic.cmake b/Tests/RunCMake/try_compile/TargetTypeStatic.cmake new file mode 100644 index 0000000..006b8b8 --- /dev/null +++ b/Tests/RunCMake/try_compile/TargetTypeStatic.cmake @@ -0,0 +1,14 @@ +enable_language(C) +set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) +try_compile(result ${CMAKE_CURRENT_BINARY_DIR} + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/other.c + OUTPUT_VARIABLE out + COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/copy + COPY_FILE_ERROR copy_err + ) +if(NOT result) + message(FATAL_ERROR "try_compile failed:\n${out}") +endif() +if(copy_err) + message(FATAL_ERROR "try_compile COPY_FILE failed:\n${copy_err}") +endif() diff --git a/Tests/RunCMake/try_compile/other.c b/Tests/RunCMake/try_compile/other.c new file mode 100644 index 0000000..6c24f10 --- /dev/null +++ b/Tests/RunCMake/try_compile/other.c @@ -0,0 +1 @@ +int other(void) { return 0; } diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt index e497503..d11cfc5 100644 --- a/Tests/TryCompile/CMakeLists.txt +++ b/Tests/TryCompile/CMakeLists.txt @@ -108,9 +108,7 @@ endif() # try to compile a file that should compile set(_c_flags "${CMAKE_C_FLAGS}") -if(CMAKE_GENERATOR STREQUAL "Visual Studio 6") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D \"TESTDEF\"") -elseif(WATCOM) +if(WATCOM) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -dTESTDEF") else() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} \"-DTESTDEF\"") diff --git a/Tests/VSExternalInclude/CMakeLists.txt b/Tests/VSExternalInclude/CMakeLists.txt index 73ea05a..20301c2 100644 --- a/Tests/VSExternalInclude/CMakeLists.txt +++ b/Tests/VSExternalInclude/CMakeLists.txt @@ -1,13 +1,10 @@ cmake_minimum_required (VERSION 2.6) project(VSExternalInclude) -if(${CMAKE_GENERATOR} MATCHES "Visual Studio 6") - set(PROJECT_EXT dsp) -else() - set(PROJECT_EXT vcproj) -endif() if(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[0124]") set(PROJECT_EXT vcxproj) +else() + set(PROJECT_EXT vcproj) endif() # make sure directories exists diff --git a/Tests/VSMidl/src/CMakeLists.txt b/Tests/VSMidl/src/CMakeLists.txt index 86c04ed..e745fdd 100644 --- a/Tests/VSMidl/src/CMakeLists.txt +++ b/Tests/VSMidl/src/CMakeLists.txt @@ -1,12 +1,6 @@ cmake_minimum_required(VERSION 2.8) project(VSMidl) -if(MSVC_VERSION GREATER 1200) - include_directories("${CMAKE_CURRENT_BINARY_DIR}/\$(IntDir)") -else() - # midl generated headers end up directly in CMAKE_CURRENT_BINARY_DIR with - # VS6 builds. - include_directories("${CMAKE_CURRENT_BINARY_DIR}") -endif() +include_directories("${CMAKE_CURRENT_BINARY_DIR}/\$(IntDir)") add_executable(VSMidl main.cpp test.idl) |