diff options
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r-- | Tests/RunCMake/CheckModules/CMP0075-stderr.txt | 50 | ||||
-rw-r--r-- | Tests/RunCMake/CheckModules/CMP0075.cmake | 124 | ||||
-rw-r--r-- | Tests/RunCMake/CheckModules/RunCMakeTest.cmake | 2 |
3 files changed, 176 insertions, 0 deletions
diff --git a/Tests/RunCMake/CheckModules/CMP0075-stderr.txt b/Tests/RunCMake/CheckModules/CMP0075-stderr.txt new file mode 100644 index 0000000..960fe94 --- /dev/null +++ b/Tests/RunCMake/CheckModules/CMP0075-stderr.txt @@ -0,0 +1,50 @@ +^CMake Warning \(dev\) at [^ +]*/Modules/CheckIncludeFile.cmake:[0-9]+ \(message\): + Policy CMP0075 is not set: Include file check macros honor + CMAKE_REQUIRED_LIBRARIES. Run "cmake --help-policy CMP0075" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + CMAKE_REQUIRED_LIBRARIES is set to: + + does_not_exist + + For compatibility with CMake 3.11 and below this check is ignoring it. +Call Stack \(most recent call first\): + CMP0075.cmake:11 \(check_include_file\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at [^ +]*/Modules/CheckIncludeFileCXX.cmake:[0-9]+ \(message\): + Policy CMP0075 is not set: Include file check macros honor + CMAKE_REQUIRED_LIBRARIES. Run "cmake --help-policy CMP0075" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + CMAKE_REQUIRED_LIBRARIES is set to: + + does_not_exist + + For compatibility with CMake 3.11 and below this check is ignoring it. +Call Stack \(most recent call first\): + CMP0075.cmake:26 \(check_include_file_cxx\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at [^ +]*/Modules/CheckIncludeFiles.cmake:[0-9]+ \(message\): + Policy CMP0075 is not set: Include file check macros honor + CMAKE_REQUIRED_LIBRARIES. Run "cmake --help-policy CMP0075" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + CMAKE_REQUIRED_LIBRARIES is set to: + + does_not_exist + + For compatibility with CMake 3.11 and below this check is ignoring it. +Call Stack \(most recent call first\): + CMP0075.cmake:41 \(check_include_files\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/CheckModules/CMP0075.cmake b/Tests/RunCMake/CheckModules/CMP0075.cmake new file mode 100644 index 0000000..4a3b720 --- /dev/null +++ b/Tests/RunCMake/CheckModules/CMP0075.cmake @@ -0,0 +1,124 @@ +enable_language(C) +enable_language(CXX) +include(CheckIncludeFile) +include(CheckIncludeFileCXX) +include(CheckIncludeFiles) + +set(CMAKE_REQUIRED_LIBRARIES does_not_exist) + +#============================================================================ + +check_include_file("stddef.h" HAVE_STDDEF_H_1) +if(NOT HAVE_STDDEF_H_1) + message(SEND_ERROR "HAVE_STDDEF_H_1 failed but should have passed.") +endif() +if(NOT _CIF_CMP0075_WARNED) + message(SEND_ERROR "HAVE_STDDEF_H_1 did not warn but should have") +endif() +check_include_file("stddef.h" HAVE_STDDEF_H_2) # second does not warn +if(NOT HAVE_STDDEF_H_2) + message(SEND_ERROR "HAVE_STDDEF_H_2 failed but should have passed.") +endif() +unset(_CIF_CMP0075_WARNED) + +#---------------------------------------------------------------------------- + +check_include_file_cxx("stddef.h" HAVE_STDDEF_H_CXX_1) +if(NOT HAVE_STDDEF_H_CXX_1) + message(SEND_ERROR "HAVE_STDDEF_H_CXX_1 failed but should have passed.") +endif() +if(NOT _CIF_CMP0075_WARNED) + message(SEND_ERROR "HAVE_STDDEF_H_CXX_1 did not warn but should have") +endif() +check_include_file_cxx("stddef.h" HAVE_STDDEF_H_CXX_2) # second does not warn +if(NOT HAVE_STDDEF_H_CXX_2) + message(SEND_ERROR "HAVE_STDDEF_H_CXX_2 failed but should have passed.") +endif() +unset(_CIF_CMP0075_WARNED) + +#---------------------------------------------------------------------------- + +check_include_files("stddef.h;stdlib.h" HAVE_STDLIB_H_1) +if(NOT HAVE_STDLIB_H_1) + message(SEND_ERROR "HAVE_STDLIB_H_1 failed but should have passed.") +endif() +if(NOT _CIF_CMP0075_WARNED) + message(SEND_ERROR "HAVE_STDLIB_H_1 did not warn but should have") +endif() +check_include_files("stddef.h;stdlib.h" HAVE_STDLIB_H_2) # second does not warn +if(NOT HAVE_STDLIB_H_2) + message(SEND_ERROR "HAVE_STDLIB_H_2 failed but should have passed.") +endif() +unset(_CIF_CMP0075_WARNED) + +#============================================================================ +cmake_policy(SET CMP0075 OLD) +# These should not warn. +# These should pass the checks due to ignoring 'does_not_exist'. + +check_include_file("stddef.h" HAVE_STDDEF_H_3) +if(NOT HAVE_STDDEF_H_3) + message(SEND_ERROR "HAVE_STDDEF_H_3 failed but should have passed.") +endif() +if(_CIF_CMP0075_WARNED) + message(SEND_ERROR "HAVE_STDDEF_H_3 warned but should not have") +endif() +unset(_CIF_CMP0075_WARNED) + +#---------------------------------------------------------------------------- + +check_include_file_cxx("stddef.h" HAVE_STDDEF_H_CXX_3) +if(NOT HAVE_STDDEF_H_CXX_3) + message(SEND_ERROR "HAVE_STDDEF_H_CXX_3 failed but should have passed.") +endif() +if(_CIF_CMP0075_WARNED) + message(SEND_ERROR "HAVE_STDDEF_H_CXX_3 warned but should not have") +endif() +unset(_CIF_CMP0075_WARNED) + +#---------------------------------------------------------------------------- + +check_include_files("stddef.h;stdlib.h" HAVE_STDLIB_H_3) +if(NOT HAVE_STDLIB_H_3) + message(SEND_ERROR "HAVE_STDLIB_H_3 failed but should have passed.") +endif() +if(_CIF_CMP0075_WARNED) + message(SEND_ERROR "HAVE_STDLIB_H_3 warned but should not have") +endif() +unset(_CIF_CMP0075_WARNED) + +#============================================================================ +cmake_policy(SET CMP0075 NEW) +# These should not warn. +# These should fail the checks due to requiring 'does_not_exist'. + +check_include_file("stddef.h" HAVE_STDDEF_H_4) +if(HAVE_STDDEF_H_4) + message(SEND_ERROR "HAVE_STDDEF_H_4 passed but should have failed.") +endif() +if(_CIF_CMP0075_WARNED) + message(SEND_ERROR "HAVE_STDDEF_H_4 warned but should not have") +endif() +unset(_CIF_CMP0075_WARNED) + +#---------------------------------------------------------------------------- + +check_include_file_cxx("stddef.h" HAVE_STDDEF_H_CXX_4) +if(HAVE_STDDEF_H_CXX_4) + message(SEND_ERROR "HAVE_STDDEF_H_CXX_4 passed but should have failed.") +endif() +if(_CIF_CMP0075_WARNED) + message(SEND_ERROR "HAVE_STDDEF_H_CXX_4 warned but should not have") +endif() +unset(_CIF_CMP0075_WARNED) + +#---------------------------------------------------------------------------- + +check_include_files("stddef.h;stdlib.h" HAVE_STDLIB_H_4) +if(HAVE_STDLIB_H_4) + message(SEND_ERROR "HAVE_STDLIB_H_4 passed but should have failed.") +endif() +if(_CIF_CMP0075_WARNED) + message(SEND_ERROR "HAVE_STDLIB_H_4 warned but should not have") +endif() +unset(_CIF_CMP0075_WARNED) diff --git a/Tests/RunCMake/CheckModules/RunCMakeTest.cmake b/Tests/RunCMake/CheckModules/RunCMakeTest.cmake index c5aaa64..8a046e1 100644 --- a/Tests/RunCMake/CheckModules/RunCMakeTest.cmake +++ b/Tests/RunCMake/CheckModules/RunCMakeTest.cmake @@ -1,5 +1,7 @@ include(RunCMake) +run_cmake(CMP0075) + run_cmake(CheckStructHasMemberOk) run_cmake(CheckStructHasMemberUnknownLanguage) run_cmake(CheckStructHasMemberMissingLanguage) |