diff options
Diffstat (limited to 'Tests')
914 files changed, 8713 insertions, 1140 deletions
diff --git a/Tests/AliasTarget/CMakeLists.txt b/Tests/AliasTarget/CMakeLists.txt index a5eb0f6..9467fae 100644 --- a/Tests/AliasTarget/CMakeLists.txt +++ b/Tests/AliasTarget/CMakeLists.txt @@ -45,3 +45,28 @@ get_property(_alt2 TARGET PREFIX::Foo PROPERTY ALIASED_TARGET) if (NOT ${_alt2} STREQUAL foo) message(SEND_ERROR "ALIASED_TARGET is not foo.") endif() + +add_library(iface INTERFACE) +add_library(Alias::Iface ALIAS iface) + +get_target_property(_notAlias1 foo ALIASED_TARGET) +if (NOT DEFINED _notAlias1) + message(SEND_ERROR "_notAlias1 is not defined") +endif() +if (_notAlias1) + message(SEND_ERROR "_notAlias1 is defined, but foo is not an ALIAS") +endif() +if (NOT _notAlias1 STREQUAL _notAlias1-NOTFOUND) + message(SEND_ERROR "_notAlias1 not defined to a -NOTFOUND variant") +endif() + +get_property(_notAlias2 TARGET foo PROPERTY ALIASED_TARGET) +if (NOT DEFINED _notAlias2) + message(SEND_ERROR "_notAlias2 is not defined") +endif() +if (_notAlias2) + message(SEND_ERROR "_notAlias2 is defined, but foo is not an ALIAS") +endif() +if (NOT _notAlias2 STREQUAL _notAlias2-NOTFOUND) + message(SEND_ERROR "_notAlias2 not defined to a -NOTFOUND variant") +endif() diff --git a/Tests/Assembler/CMakeLists.txt b/Tests/Assembler/CMakeLists.txt index bb4bccc..fdc5c00 100644 --- a/Tests/Assembler/CMakeLists.txt +++ b/Tests/Assembler/CMakeLists.txt @@ -9,12 +9,15 @@ set(SRCS) # and also generate assembler files from C: if("${CMAKE_GENERATOR}" MATCHES "Makefile|Xcode" AND NOT CMAKE_OSX_ARCHITECTURES) - if(("${CMAKE_C_COMPILER_ID}" MATCHES "^(GNU|Clang|HP|SunPro|XL)$") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel" AND UNIX)) + if(("${CMAKE_C_COMPILER_ID}" MATCHES "^(GNU|Clang|AppleClang|HP|SunPro|XL)$") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel" AND UNIX)) set(C_FLAGS "${CMAKE_C_FLAGS}") separate_arguments(C_FLAGS) if(CMAKE_OSX_SYSROOT AND CMAKE_C_SYSROOT_FLAG AND NOT ";${C_FLAGS};" MATCHES ";${CMAKE_C_SYSROOT_FLAG};") list(APPEND C_FLAGS ${CMAKE_C_SYSROOT_FLAG} ${CMAKE_OSX_SYSROOT}) endif() + # Clang on OS X, and perhaps other compilers, do not support -g + # for both generating and assembling, so drop it from generating. + list(REMOVE_ITEM C_FLAGS -g) set(SRCS main.s) add_custom_command( OUTPUT main.s diff --git a/Tests/BootstrapTest.cmake b/Tests/BootstrapTest.cmake new file mode 100644 index 0000000..9c9fe09 --- /dev/null +++ b/Tests/BootstrapTest.cmake @@ -0,0 +1,10 @@ +file(MAKE_DIRECTORY "${bin_dir}") +message(STATUS "running bootstrap: ${bootstrap}") +execute_process( + COMMAND ${bootstrap} + WORKING_DIRECTORY "${bin_dir}" + RESULT_VARIABLE result + ) +if(result) + message(FATAL_ERROR "bootstrap failed: ${result}") +endif() diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt index 0687154..9727930 100644 --- a/Tests/BuildDepends/CMakeLists.txt +++ b/Tests/BuildDepends/CMakeLists.txt @@ -13,7 +13,7 @@ project(BuildDepends) set(CMAKE_SUPPRESS_REGENERATION 1) # Xcode needs some help with the fancy dependencies in this test. -if("${CMAKE_GENERATOR}" MATCHES "Xcode") +if(XCODE AND XCODE_VERSION VERSION_LESS 5) set(HELP_XCODE 1) endif() function(help_xcode_depends) diff --git a/Tests/BundleUtilities/CMakeLists.txt b/Tests/BundleUtilities/CMakeLists.txt index 5cc7071..3a1cf55 100644 --- a/Tests/BundleUtilities/CMakeLists.txt +++ b/Tests/BundleUtilities/CMakeLists.txt @@ -25,13 +25,11 @@ set_target_properties(shared shared2 framework PROPERTIES # testbundleutils1 will load this at runtime add_library(module1 MODULE module.cpp module.h) set_target_properties(module1 PROPERTIES PREFIX "") -get_target_property(module_loc module1 LOCATION) target_link_libraries(module1 shared2) # a bundle application add_executable(testbundleutils1 MACOSX_BUNDLE testbundleutils1.cpp) target_link_libraries(testbundleutils1 shared framework ${CMAKE_DL_LIBS}) -get_target_property(loc testbundleutils1 LOCATION) set_target_properties(testbundleutils1 module1 PROPERTIES INSTALL_RPATH "${CMAKE_CURRENT_BINARY_DIR}/testdir1" @@ -40,8 +38,8 @@ set_target_properties(testbundleutils1 module1 PROPERTIES # add custom target to install and test the app add_custom_target(testbundleutils1_test ALL COMMAND ${CMAKE_COMMAND} - "-DINPUT=${loc}" - "-DMODULE=${module_loc}" + "-DINPUT=$<TARGET_FILE:testbundleutils1>" + "-DMODULE=$<TARGET_FILE:module1>" "-DINPUTDIR=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}" "-DOUTPUTDIR=${CMAKE_CURRENT_BINARY_DIR}/testdir1" -P "${CMAKE_CURRENT_SOURCE_DIR}/bundleutils.cmake" @@ -58,13 +56,11 @@ add_dependencies(testbundleutils1_test testbundleutils1) # testbundleutils2 will load this at runtime add_library(module2 MODULE module.cpp module.h) set_target_properties(module2 PROPERTIES PREFIX "") -get_target_property(module_loc module2 LOCATION) target_link_libraries(module2 shared2) # a non-bundle application add_executable(testbundleutils2 testbundleutils2.cpp) target_link_libraries(testbundleutils2 shared framework ${CMAKE_DL_LIBS}) -get_target_property(loc testbundleutils2 LOCATION) set_target_properties(testbundleutils2 module2 PROPERTIES INSTALL_RPATH "${CMAKE_CURRENT_BINARY_DIR}/testdir2" @@ -73,8 +69,8 @@ set_target_properties(testbundleutils2 module2 PROPERTIES # add custom target to install and test the app add_custom_target(testbundleutils2_test ALL COMMAND ${CMAKE_COMMAND} - "-DINPUT=${loc}" - "-DMODULE=${module_loc}" + "-DINPUT=$<TARGET_FILE:testbundleutils2>" + "-DMODULE=$<TARGET_FILE:module2>" "-DINPUTDIR=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}" "-DOUTPUTDIR=${CMAKE_CURRENT_BINARY_DIR}/testdir2" -P "${CMAKE_CURRENT_SOURCE_DIR}/bundleutils.cmake" @@ -106,13 +102,11 @@ if(APPLE AND NOT CMAKE_SYSTEM_VERSION VERSION_LESS 9.0) # testbundleutils1 will load this at runtime add_library(module3 MODULE module.cpp module.h) set_target_properties(module3 PROPERTIES PREFIX "" LINK_FLAGS "-Wl,-rpath,@loader_path/") - get_target_property(module_loc module3 LOCATION) target_link_libraries(module3 shared2-3) # a non-bundle application add_executable(testbundleutils3 testbundleutils3.cpp) target_link_libraries(testbundleutils3 shared-3 framework-3 ${CMAKE_DL_LIBS}) - get_target_property(loc testbundleutils3 LOCATION) set_target_properties(testbundleutils3 module3 PROPERTIES LINK_FLAGS "-Wl,-rpath,@loader_path/") @@ -120,8 +114,8 @@ if(APPLE AND NOT CMAKE_SYSTEM_VERSION VERSION_LESS 9.0) # add custom target to install and test the app add_custom_target(testbundleutils3_test ALL COMMAND ${CMAKE_COMMAND} - "-DINPUT=${loc}" - "-DMODULE=${module_loc}" + "-DINPUT=$<TARGET_FILE:testbundleutils3>" + "-DMODULE=$<TARGET_FILE:module3>" "-DINPUTDIR=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}" "-DOUTPUTDIR=${CMAKE_CURRENT_BINARY_DIR}/testdir3" -P "${CMAKE_CURRENT_SOURCE_DIR}/bundleutils.cmake" diff --git a/Tests/CFBundleTest/CMakeLists.txt b/Tests/CFBundleTest/CMakeLists.txt index bf9771c..5cda527 100644 --- a/Tests/CFBundleTest/CMakeLists.txt +++ b/Tests/CFBundleTest/CMakeLists.txt @@ -30,8 +30,14 @@ if(NOT RC_COMPILER) message(FATAL_ERROR "could not find Rez to build resources from .r file...") endif() +set(sysroot) +if(CMAKE_OSX_SYSROOT) + set(sysroot -isysroot ${CMAKE_OSX_SYSROOT}) +endif() + execute_process(COMMAND - ${RC_COMPILER} ${RCFILES} -useDF -o ${CMAKE_CURRENT_BINARY_DIR}/Localized.rsrc + ${RC_COMPILER} ${sysroot} ${RCFILES} -useDF + -o ${CMAKE_CURRENT_BINARY_DIR}/Localized.rsrc ) set_source_files_properties( diff --git a/Tests/CMakeCommands/add_compile_options/CMakeLists.txt b/Tests/CMakeCommands/add_compile_options/CMakeLists.txt index 1652cf6..995b32c 100644 --- a/Tests/CMakeCommands/add_compile_options/CMakeLists.txt +++ b/Tests/CMakeCommands/add_compile_options/CMakeLists.txt @@ -12,3 +12,10 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") "DO_GNU_TESTS" ) endif() + +add_compile_options(-rtti) +add_library(imp UNKNOWN IMPORTED) +get_target_property(_res imp COMPILE_OPTIONS) +if (_res) + message(SEND_ERROR "add_compile_options populated the COMPILE_OPTIONS target property") +endif() diff --git a/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt b/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt index 900dbd0..14d40aa 100644 --- a/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt +++ b/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt @@ -25,3 +25,10 @@ target_compile_definitions(consumer target_compile_definitions(consumer PRIVATE ) + +add_definitions(-DSOME_DEF) +add_library(imp UNKNOWN IMPORTED) +get_target_property(_res imp COMPILE_DEFINITIONS) +if (_res) + message(SEND_ERROR "add_definitions populated the COMPILE_DEFINITIONS target property") +endif() diff --git a/Tests/CMakeCommands/target_include_directories/CMakeLists.txt b/Tests/CMakeCommands/target_include_directories/CMakeLists.txt index 21b8e15..661bbaa 100644 --- a/Tests/CMakeCommands/target_include_directories/CMakeLists.txt +++ b/Tests/CMakeCommands/target_include_directories/CMakeLists.txt @@ -45,7 +45,8 @@ add_executable(consumer target_include_directories(consumer PRIVATE $<TARGET_PROPERTY:target_include_directories,INTERFACE_INCLUDE_DIRECTORIES> - relative_dir + relative_dir + relative_dir/$<TARGET_PROPERTY:NAME> ) # Test no items @@ -61,3 +62,10 @@ target_include_directories(consumer target_include_directories(consumer SYSTEM PRIVATE ) + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) +add_library(imp UNKNOWN IMPORTED) +get_target_property(_res imp INCLUDE_DIRECTORIES) +if (_res) + message(SEND_ERROR "include_directories populated the INCLUDE_DIRECTORIES target property") +endif() diff --git a/Tests/CMakeCommands/target_include_directories/consumer.cpp b/Tests/CMakeCommands/target_include_directories/consumer.cpp index 82b800a..7e3443e 100644 --- a/Tests/CMakeCommands/target_include_directories/consumer.cpp +++ b/Tests/CMakeCommands/target_include_directories/consumer.cpp @@ -3,6 +3,7 @@ #include "publicinclude.h" #include "interfaceinclude.h" #include "relative_dir.h" +#include "consumer.h" #ifdef PRIVATEINCLUDE_DEFINE #error Unexpected PRIVATEINCLUDE_DEFINE @@ -24,4 +25,8 @@ #error Expected RELATIVE_DIR_DEFINE #endif +#ifndef CONSUMER_DEFINE +#error Expected CONSUMER_DEFINE +#endif + int main() { return 0; } diff --git a/Tests/CMakeCommands/target_include_directories/relative_dir/consumer/consumer.h b/Tests/CMakeCommands/target_include_directories/relative_dir/consumer/consumer.h new file mode 100644 index 0000000..b915373 --- /dev/null +++ b/Tests/CMakeCommands/target_include_directories/relative_dir/consumer/consumer.h @@ -0,0 +1,2 @@ + +#define CONSUMER_DEFINE diff --git a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt index 06019e6..e11f980 100644 --- a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt +++ b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt @@ -32,7 +32,7 @@ generate_export_header(depA) add_library(depB SHARED depB.cpp) generate_export_header(depB) -target_link_libraries(depB LINK_PRIVATE depA) +target_link_libraries(depB LINK_PRIVATE depA LINK_PRIVATE depA) add_library(libgenex SHARED libgenex.cpp) generate_export_header(libgenex) @@ -44,11 +44,11 @@ set_property(TARGET depB APPEND PROPERTY add_library(depC SHARED depC.cpp) generate_export_header(depC) -target_link_libraries(depC LINK_PUBLIC depA) +target_link_libraries(depC LINK_PUBLIC depA LINK_PUBLIC depA) assert_property(depA LINK_INTERFACE_LIBRARIES "") assert_property(depB LINK_INTERFACE_LIBRARIES "") -assert_property(depC LINK_INTERFACE_LIBRARIES "depA") +assert_property(depC LINK_INTERFACE_LIBRARIES "depA;depA") add_executable(targetA targetA.cpp) diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt index 07d7c43..818b8c9 100644 --- a/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt @@ -22,6 +22,16 @@ generate_export_header(staticlib1) add_library(staticlib2 STATIC staticlib2.cpp) generate_export_header(staticlib2) target_link_libraries(staticlib1 LINK_PUBLIC staticlib2) +if (CMAKE_CXX_COMPILER_ID MATCHES GNU OR CMAKE_CXX_COMPILER_ID MATCHES Clang) + target_link_libraries(staticlib1 LINK_PRIVATE "-Wl,-v") +endif() add_executable(staticlib_exe staticlib_exe.cpp) target_link_libraries(staticlib_exe staticlib1) + +add_library(onlyplainlib1 SHARED onlyplainlib1.cpp) +add_library(onlyplainlib2 SHARED onlyplainlib2.cpp) +target_link_libraries(onlyplainlib2 onlyplainlib1) + +add_executable(onlyplainlib_user onlyplainlib_user.cpp) +target_link_libraries(onlyplainlib_user onlyplainlib2) diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib1.cpp b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib1.cpp new file mode 100644 index 0000000..41dc3ce --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib1.cpp @@ -0,0 +1,13 @@ + +#include "onlyplainlib1.h" + +OnlyPlainLib1::OnlyPlainLib1() + : result(0) +{ + +} + +int OnlyPlainLib1::GetResult() +{ + return result; +} diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib1.h b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib1.h new file mode 100644 index 0000000..c0373ce --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib1.h @@ -0,0 +1,14 @@ + +struct +#ifdef _WIN32 +__declspec(dllexport) +#endif +OnlyPlainLib1 +{ + OnlyPlainLib1(); + + int GetResult(); + +private: + int result; +}; diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib2.cpp b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib2.cpp new file mode 100644 index 0000000..2865ae9 --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib2.cpp @@ -0,0 +1,8 @@ + +#include "onlyplainlib2.h" + +OnlyPlainLib1 onlyPlainLib2() +{ + OnlyPlainLib1 opl1; + return opl1; +} diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib2.h b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib2.h new file mode 100644 index 0000000..74b18a0 --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib2.h @@ -0,0 +1,7 @@ + +#include "onlyplainlib1.h" + +#ifdef _WIN32 +__declspec(dllexport) +#endif +OnlyPlainLib1 onlyPlainLib2(); diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib_user.cpp b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib_user.cpp new file mode 100644 index 0000000..0fb7b0a --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib_user.cpp @@ -0,0 +1,7 @@ + +#include "onlyplainlib2.h" + +int main(int argc, char **argv) +{ + return onlyPlainLib2().GetResult(); +} diff --git a/Tests/CMakeCopyright.cmake b/Tests/CMakeCopyright.cmake new file mode 100644 index 0000000..a7201e9 --- /dev/null +++ b/Tests/CMakeCopyright.cmake @@ -0,0 +1,22 @@ +if(CMAKE_VERSION MATCHES "\\.(20[0-9][0-9])[0-9][0-9][0-9][0-9](-|$)") + set(version_year "${CMAKE_MATCH_1}") + set(copyright_line_regex "^Copyright 2000-(20[0-9][0-9]) Kitware") + file(STRINGS "${CMAKE_CURRENT_LIST_DIR}/../Copyright.txt" copyright_line + LIMIT_COUNT 1 REGEX "${copyright_line_regex}") + if(copyright_line MATCHES "${copyright_line_regex}") + set(copyright_year "${CMAKE_MATCH_1}") + if(copyright_year LESS version_year) + message(FATAL_ERROR "Copyright.txt contains\n" + " ${copyright_line}\n" + "but the current version year is ${version_year}.") + else() + message(STATUS "PASSED: Copyright.txt contains\n" + " ${copyright_line}\n" + "and the current version year is ${version_year}.") + endif() + else() + message(FATAL_ERROR "Copyright.txt has no Copyright line of expected format!") + endif() +else() + message(STATUS "SKIPPED: CMAKE_VERSION does not know the year: ${CMAKE_VERSION}") +endif() diff --git a/Tests/CMakeInstall.cmake b/Tests/CMakeInstall.cmake index 5f814d9..fda8c54 100644 --- a/Tests/CMakeInstall.cmake +++ b/Tests/CMakeInstall.cmake @@ -17,29 +17,15 @@ if(CMake_TEST_INSTALL) if(CMAKE_CONFIGURATION_TYPES) # There are multiple configurations. Make sure the tested # configuration is the one that is installed. - set(CMake_TEST_INSTALL_CONFIG -C "\${CTEST_CONFIGURATION_TYPE}") + set(CMake_TEST_INSTALL_CONFIG --config $<CONFIGURATION>) else() set(CMake_TEST_INSTALL_CONFIG) endif() - # The CTest of the CMake used to build this CMake. - if(CMAKE_CTEST_COMMAND) - set(CMake_TEST_INSTALL_CTest ${CMAKE_CTEST_COMMAND}) - else() - set(CMake_TEST_INSTALL_CTest ${CMake_BIN_DIR}/ctest) - endif() - # Add a test to install CMake through the build system install target. - add_test(CMake.Install - ${CMake_TEST_INSTALL_CTest} - ${CMake_TEST_INSTALL_CONFIG} - --build-and-test ${CMake_SOURCE_DIR} ${CMake_BINARY_DIR} - --build-generator ${CMAKE_GENERATOR} # Not CMAKE_TEST_GENERATOR - --build-project CMake - --build-makeprogram ${CMAKE_MAKE_PROGRAM} # Not CMAKE_TEST_MAKEPROGRAM - --build-nocmake - --build-noclean - --build-target install) + add_test(NAME CMake.Install + COMMAND cmake --build . --target install ${CMake_TEST_INSTALL_CONFIG} + ) # Avoid running this test simultaneously with other tests: set_tests_properties(CMake.Install PROPERTIES RUN_SERIAL ON) diff --git a/Tests/CMakeLib/CMakeLists.txt b/Tests/CMakeLib/CMakeLists.txt index a831e30..0e1fe8d 100644 --- a/Tests/CMakeLib/CMakeLists.txt +++ b/Tests/CMakeLib/CMakeLists.txt @@ -6,13 +6,14 @@ include_directories( set(CMakeLib_TESTS testGeneratedFileStream + testRST testSystemTools testUTF8 testXMLParser testXMLSafe ) -if(WIN32 AND NOT UNIX) # Just if(WIN32) when CMake >= 2.8.4 is required +if(WIN32) list(APPEND CMakeLib_TESTS testVisualStudioSlnParser ) diff --git a/Tests/CMakeLib/testRST.cxx b/Tests/CMakeLib/testRST.cxx new file mode 100644 index 0000000..bad9560 --- /dev/null +++ b/Tests/CMakeLib/testRST.cxx @@ -0,0 +1,96 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2013 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmRST.h" + +#include "cmSystemTools.h" + +void reportLine(std::ostream& os, bool ret, std::string line, bool eol) +{ + if(ret) + { + os << "\"" << line << "\" (" << (eol?"with EOL":"without EOL") << ")"; + } + else + { + os << "EOF"; + } +} + +int testRST(int, char*[]) +{ + std::string dir = cmSystemTools::GetFilenamePath(__FILE__); + if(dir.empty()) + { + dir = "."; + } + std::string a_name = "testRST.actual"; + std::string e_name = dir + "/testRST.expect"; + + // Process the test RST file. + { + std::string fname = dir + "/testRST.rst"; + std::ofstream fout(a_name.c_str()); + if(!fout) + { + std::cerr << "Could not open output " << a_name << std::endl; + return 1; + } + + cmRST r(fout, dir); + if(!r.ProcessFile(fname)) + { + std::cerr << "Could not open input " << fname << std::endl; + return 1; + } + } + + // Compare expected and actual outputs. + std::ifstream e_fin(e_name.c_str()); + std::ifstream a_fin(a_name.c_str()); + if(!e_fin) + { + std::cerr << "Could not open input " << e_name << std::endl; + return 1; + } + if(!a_fin) + { + std::cerr << "Could not open input " << a_name << std::endl; + return 1; + } + int lineno = 0; + bool e_ret; + bool a_ret; + do + { + std::string e_line; + std::string a_line; + bool e_eol; + bool a_eol; + e_ret = cmSystemTools::GetLineFromStream(e_fin, e_line, &e_eol); + a_ret = cmSystemTools::GetLineFromStream(a_fin, a_line, &a_eol); + ++lineno; + if(e_ret != a_ret || e_line != a_line || e_eol != a_eol) + { + a_fin.seekg(0, std::ios::beg); + std::cerr << "Actual output does not match that expected on line " + << lineno << "." << std::endl << "Expected "; + reportLine(std::cerr, e_ret, e_line, e_eol); + std::cerr << " but got "; + reportLine(std::cerr, a_ret, a_line, a_eol); + std::cerr << "." << std::endl + << "Actual output:" << std::endl + << a_fin.rdbuf(); + return 1; + } + } while(e_ret && a_ret); + return 0; +} diff --git a/Tests/CMakeLib/testRST.expect b/Tests/CMakeLib/testRST.expect new file mode 100644 index 0000000..fa436cb --- /dev/null +++ b/Tests/CMakeLib/testRST.expect @@ -0,0 +1,92 @@ +title_text +---------- + +Command ``some_cmd()`` explicit cmake domain. +Command ``some_cmd()`` without target. +Command ``some_cmd`` with target. +Command ``some_cmd_<cmd>()`` placeholder without target. +Command ``some_cmd_<cmd>`` placholder with target. +Command ``some_cmd()`` with parens. +Command ``some_cmd(SUB)`` with subcommand. +Command ``some_cmd(SUB)`` with subcommand and target. +Command ``some_cmd (SUB)`` with space and subcommand and target. +Command ``some command`` with space and target. +Variable ``some variable`` space and target. +Variable ``<PLACEHOLDER>_VARIABLE`` with leading placeholder. +Variable ``VARIABLE_<PLACEHOLDER>`` with trailing placeholder. +Variable ``<PLACEHOLDER>_VARIABLE`` with leading placeholder and target. +Variable ``VARIABLE_<PLACEHOLDER>`` with trailing placeholder and target. +Generator ``Some Generator`` with space. + +First TOC entry. + +|not replaced| +Second TOC entry. + +CMake Module Content + +More CMake Module Content + +Bracket Comment Content + +[ +Bracket Comment Content +] + +.. cmake:command:: some_cmd + + Command some_cmd description. + +.. command:: other_cmd + + Command other_cmd description. + +.. cmake:variable:: some_var + + Variable some_var description. + +.. variable:: other_var + + Variable other_var description. + + Parsed-literal included without directive. + Common Indentation Removed + # replaced in parsed literal + + # Sample CMake code block + if(condition) + message(indented) + endif() + # |not replaced in literal| + +A literal block starts after a line consisting of two colons + +:: + + Literal block. + Common Indentation Removed + # |not replaced in literal| + +or after a paragraph ending in two colons:: + + Literal block. + Common Indentation Removed + # |not replaced in literal| + +but not after a line ending in two colons:: +in the middle of a paragraph. + +.. productionlist:: + grammar: `production` + production: "content rendered" + +.. note:: + Notes are called out. + +substituted text with multiple lines becomes one line + +End of first include. + +Cross-include substitution text with ``some_cmd()`` reference. + +End of second include. diff --git a/Tests/CMakeLib/testRST.rst b/Tests/CMakeLib/testRST.rst new file mode 100644 index 0000000..54952dd --- /dev/null +++ b/Tests/CMakeLib/testRST.rst @@ -0,0 +1,99 @@ +.. index:: + single: directive ignored + +title_text +---------- + +.. comment ignored +.. + comment ignored + +Command :cmake:command:`some_cmd` explicit cmake domain. +Command :command:`some_cmd` without target. +Command :command:`some_cmd <some_cmd>` with target. +Command :command:`some_cmd_<cmd>` placeholder without target. +Command :command:`some_cmd_<cmd> <some_cmd>` placholder with target. +Command :command:`some_cmd()` with parens. +Command :command:`some_cmd(SUB)` with subcommand. +Command :command:`some_cmd(SUB) <some_cmd>` with subcommand and target. +Command :command:`some_cmd (SUB) <some_cmd>` with space and subcommand and target. +Command :command:`some command <some_cmd>` with space and target. +Variable :variable:`some variable <some_var>` space and target. +Variable :variable:`<PLACEHOLDER>_VARIABLE` with leading placeholder. +Variable :variable:`VARIABLE_<PLACEHOLDER>` with trailing placeholder. +Variable :variable:`<PLACEHOLDER>_VARIABLE <target>` with leading placeholder and target. +Variable :variable:`VARIABLE_<PLACEHOLDER> <target>` with trailing placeholder and target. +Generator :generator:`Some Generator` with space. + +.. |not replaced| replace:: not replaced through toctree +.. |not replaced in literal| replace:: replaced in parsed literal + +.. toctree:: + :maxdepth: 2 + + testRSTtoc1 + /testRSTtoc2 + +.. cmake-module:: testRSTmod.cmake + +.. cmake:command:: some_cmd + + Command some_cmd description. + +.. command:: other_cmd + + Command other_cmd description. + +.. cmake:variable:: some_var + + Variable some_var description. + +.. variable:: other_var + + Variable other_var description. + +.. parsed-literal:: + + Parsed-literal included without directive. + Common Indentation Removed + # |not replaced in literal| + +.. code-block:: cmake + + # Sample CMake code block + if(condition) + message(indented) + endif() + # |not replaced in literal| + +A literal block starts after a line consisting of two colons + +:: + + Literal block. + Common Indentation Removed + # |not replaced in literal| + +or after a paragraph ending in two colons:: + + Literal block. + Common Indentation Removed + # |not replaced in literal| + +but not after a line ending in two colons:: +in the middle of a paragraph. + +.. productionlist:: + grammar: `production` + production: "content rendered" + +.. note:: + Notes are called out. + +.. |substitution| replace:: + |nested substitution| + with multiple lines becomes one line +.. |nested substitution| replace:: substituted text + +.. include:: testRSTinclude1.rst +.. include:: /testRSTinclude2.rst diff --git a/Tests/CMakeLib/testRSTinclude1.rst b/Tests/CMakeLib/testRSTinclude1.rst new file mode 100644 index 0000000..91d394e --- /dev/null +++ b/Tests/CMakeLib/testRSTinclude1.rst @@ -0,0 +1,6 @@ +|substitution| + +.. |cross-include substitution| replace:: Cross-include substitution text + with :command:`some_cmd` reference. + +End of first include. diff --git a/Tests/CMakeLib/testRSTinclude2.rst b/Tests/CMakeLib/testRSTinclude2.rst new file mode 100644 index 0000000..f2d619c --- /dev/null +++ b/Tests/CMakeLib/testRSTinclude2.rst @@ -0,0 +1,3 @@ +|cross-include substitution| + +End of second include. diff --git a/Tests/CMakeLib/testRSTmod.cmake b/Tests/CMakeLib/testRSTmod.cmake new file mode 100644 index 0000000..8b807a6 --- /dev/null +++ b/Tests/CMakeLib/testRSTmod.cmake @@ -0,0 +1,11 @@ +#.rst: +# CMake Module Content +#.rst: +# More CMake Module Content +#[[.rst: +Bracket Comment Content +# not part of content]] # not part of content +#[=[.rst: +[ +Bracket Comment Content +]]=] # not part of content diff --git a/Tests/CMakeLib/testRSTtoc1.rst b/Tests/CMakeLib/testRSTtoc1.rst new file mode 100644 index 0000000..fa7806e --- /dev/null +++ b/Tests/CMakeLib/testRSTtoc1.rst @@ -0,0 +1,2 @@ +.. |not replaced| replace:: not replaced across toctree +First TOC entry. diff --git a/Tests/CMakeLib/testRSTtoc2.rst b/Tests/CMakeLib/testRSTtoc2.rst new file mode 100644 index 0000000..9fd2fcb --- /dev/null +++ b/Tests/CMakeLib/testRSTtoc2.rst @@ -0,0 +1,2 @@ +|not replaced| +Second TOC entry. diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 9c3ed59..a79111a 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -10,7 +10,9 @@ macro(ADD_TEST_MACRO NAME COMMAND) --build-two-config ${build_generator_args} --build-project ${proj} - ${${NAME}_EXTRA_OPTIONS} + ${${NAME}_CTEST_OPTIONS} + --build-options ${build_options} + ${${NAME}_BUILD_OPTIONS} --test-command ${COMMAND} ${ARGN}) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${dir}") endmacro() @@ -43,12 +45,25 @@ configure_file(${CMake_SOURCE_DIR}/Tests/EnforceConfig.cmake.in # Testing if(BUILD_TESTING) + set(CMAKE_TEST_DEVENV "") + if(NOT CMAKE_TEST_DIFFERENT_GENERATOR) + if(CMAKE_TEST_GENERATOR MATCHES "Visual Studio") + set(CMAKE_TEST_MAKEPROGRAM "") + else() + set(CMAKE_TEST_MAKEPROGRAM "${CMAKE_MAKE_PROGRAM}") + endif() + if(CMAKE_TEST_GENERATOR MATCHES "Visual Studio [7-9] " AND + NOT CMAKE_MAKE_PROGRAM MATCHES "[mM][sS][bB][uU][iI][lL][dD]\\.[eE][xX][eE]") + set(CMAKE_TEST_DEVENV "${CMAKE_MAKE_PROGRAM}") + endif() + endif() + if("${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles" OR ("${CMAKE_TEST_GENERATOR}" MATCHES Ninja AND NOT WIN32)) set(TEST_CompileCommandOutput 1) endif() set(MAKE_IS_GNU ) - if(${CMAKE_TEST_MAKEPROGRAM} MATCHES make) + if(CMAKE_TEST_MAKEPROGRAM MATCHES make) execute_process(COMMAND ${CMAKE_TEST_MAKEPROGRAM} no_such_target --version RESULT_VARIABLE res OUTPUT_VARIABLE out ERROR_VARIABLE out) if("${res}" STREQUAL "0") @@ -60,8 +75,8 @@ if(BUILD_TESTING) # some old versions of make simply cannot handle spaces in paths if (MAKE_IS_GNU OR - "${CMAKE_TEST_MAKEPROGRAM}" MATCHES "nmake|gmake|wmake" OR - "${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio|XCode|Borland") + CMAKE_TEST_MAKEPROGRAM MATCHES "nmake|gmake|wmake" OR + CMAKE_TEST_GENERATOR MATCHES "Visual Studio|XCode|Borland") set(MAKE_SUPPORTS_SPACES 1) else() set(MAKE_SUPPORTS_SPACES 0) @@ -69,7 +84,6 @@ if(BUILD_TESTING) set(build_generator_args --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} ) if(CMAKE_TEST_GENERATOR_TOOLSET) list(APPEND build_generator_args @@ -77,6 +91,11 @@ if(BUILD_TESTING) ) endif() + set(build_options) + if(CMAKE_TEST_MAKEPROGRAM) + list(APPEND build_options -DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM}) + endif() + add_subdirectory(CMakeLib) add_subdirectory(CMakeOnly) add_subdirectory(RunCMake) @@ -161,6 +180,9 @@ if(BUILD_TESTING) set(CMAKE_LONG_TEST_TIMEOUT 1500) endif() + add_test(NAME CMake.Copyright + COMMAND cmake -P ${CMAKE_CURRENT_SOURCE_DIR}/CMakeCopyright.cmake) + # add a bunch of standard build-and-test style tests ADD_TEST_MACRO(CommandLineTest CommandLineTest) ADD_TEST_MACRO(FindPackageTest FindPackageTest) @@ -238,6 +260,7 @@ if(BUILD_TESTING) ADD_TEST_MACRO(Assembler HelloAsm) ADD_TEST_MACRO(SourceGroups SourceGroups) ADD_TEST_MACRO(Preprocess Preprocess) + set(ExportImport_BUILD_OPTIONS -DCMAKE_TEST_MAKEPROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM}) ADD_TEST_MACRO(ExportImport ExportImport) ADD_TEST_MACRO(Unset Unset) ADD_TEST_MACRO(PolicyScope PolicyScope) @@ -246,6 +269,8 @@ if(BUILD_TESTING) ADD_TEST_MACRO(CompileOptions CompileOptions) ADD_TEST_MACRO(CompatibleInterface CompatibleInterface) ADD_TEST_MACRO(AliasTarget AliasTarget) + ADD_TEST_MACRO(StagingPrefix StagingPrefix) + ADD_TEST_MACRO(InterfaceLibrary InterfaceLibrary) set_tests_properties(EmptyLibrary PROPERTIES PASS_REGULAR_EXPRESSION "CMake Error: CMake can not determine linker language for target: test") ADD_TEST_MACRO(CrossCompile CrossCompile) @@ -263,7 +288,7 @@ if(BUILD_TESTING) list(APPEND TEST_BUILD_DIRS ${CMake_TEST_INSTALL_PREFIX}) if(NOT QT4_FOUND) - find_package(Qt4) + find_package(Qt4 QUIET) endif() if(QT4_FOUND) @@ -298,6 +323,7 @@ if(BUILD_TESTING) "${CMake_BINARY_DIR}/Tests/BundleUtilities" ${build_generator_args} --build-project BundleUtilities + --build-options ${build_options} ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BundleUtilities") @@ -310,7 +336,7 @@ if(BUILD_TESTING) "${CMake_BINARY_DIR}/Tests/Qt4Deploy" ${build_generator_args} --build-project Qt4Deploy - --build-options + --build-options ${build_options} -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} ) @@ -348,7 +374,8 @@ if(BUILD_TESTING) --build-project ExternalDataTest --build-noclean --force-new-ctest-process - --build-options -DMAKE_SUPPORTS_SPACES=${MAKE_SUPPORTS_SPACES} + --build-options ${build_options} + -DMAKE_SUPPORTS_SPACES=${MAKE_SUPPORTS_SPACES} --test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} -V ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Module/ExternalData") @@ -381,7 +408,8 @@ if(BUILD_TESTING) ${build_generator_args} --build-project LinkFlags --build-target LinkFlags - --build-options -DTEST_CONFIG=\${CTEST_CONFIGURATION_TYPE} + --build-options ${build_options} + -DTEST_CONFIG=\${CTEST_CONFIGURATION_TYPE} ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LinkFlags") @@ -427,8 +455,8 @@ if(BUILD_TESTING) --build-two-config --build-generator "Eclipse CDT4 - Unix Makefiles" --build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}" - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-project Simple + --build-options ${build_options} --test-command Simple) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_EclipseGenerator") endif () @@ -442,8 +470,8 @@ if(BUILD_TESTING) --build-two-config --build-generator "CodeBlocks - Unix Makefiles" --build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}" - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-project Simple + --build-options ${build_options} --test-command Simple) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_CodeBlocksGenerator") endif () @@ -456,8 +484,8 @@ if(BUILD_TESTING) --build-two-config --build-generator "KDevelop3 - Unix Makefiles" --build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}" - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-project Simple + --build-options ${build_options} --test-command Simple) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_KDevelop3Generator") endif () @@ -465,8 +493,8 @@ if(BUILD_TESTING) endif() # test for correct sub-project generation - # not implemented in VS6 or Xcode - if(NOT MSVC60 AND NOT XCODE AND NOT MSVC70) + # not implemented in VS 6, VS 7.0, Xcode, or Ninja + if(NOT CMAKE_TEST_GENERATOR MATCHES "Visual Studio [67]$|Xcode|Ninja") # run cmake and configure all of SubProject # but only build the independent executable car add_test(SubProject ${CMAKE_CTEST_COMMAND} @@ -476,40 +504,38 @@ if(BUILD_TESTING) --build-project SubProject ${build_generator_args} --build-target car + --build-options ${build_options} --test-command car ) - if(${CMAKE_TEST_GENERATOR} MATCHES "Ninja") - # The Ninja generator does not create a recursive build system. Start - # from the root directory. - set(SubProject_SUBDIR) - else() - set(SubProject_SUBDIR "/foo") - endif() - # For stage 2, do not run cmake again. # Then build the foo sub project which should build # the bar library which should be referenced because # foo links to the static library bar, but bar is not # directly in the foo sub project + if(CMAKE_TEST_MAKEPROGRAM) + set(SubProject-Stage2_BUILD_MAKEPROGRAM + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ) + endif() add_test(SubProject-Stage2 ${CMAKE_CTEST_COMMAND} --build-and-test - "${CMake_SOURCE_DIR}/Tests/SubProject${SubProject_SUBDIR}" - "${CMake_BINARY_DIR}/Tests/SubProject${SubProject_SUBDIR}" - ${build_generator_args} + "${CMake_SOURCE_DIR}/Tests/SubProject/foo" + "${CMake_BINARY_DIR}/Tests/SubProject/foo" + --build-generator ${CMAKE_TEST_GENERATOR} + --build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}" + ${SubProject-Stage2_BUILD_MAKEPROGRAM} --build-nocmake --build-project foo --build-target foo --build-exe-dir "${CMake_BINARY_DIR}/Tests/SubProject/foo" + --build-options ${build_options} --test-command foo ) set_tests_properties ( SubProject-Stage2 PROPERTIES DEPENDS SubProject) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubProject") endif() - if (CMAKE_STRICT) - ADD_TEST_MACRO(DocTest DocTest) - endif () # macro to add a test that will build a nightly release # of CMake for given platform using the release scripts macro(ADD_NIGHTLY_BUILD_TEST name script) @@ -544,7 +570,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-two-config ${build_generator_args} --build-project Framework - --build-options + --build-options ${build_options} "-DCMAKE_INSTALL_PREFIX:PATH=${CMake_BINARY_DIR}/Tests/Framework/Install" --test-command bar) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Framework") @@ -556,6 +582,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-two-config ${build_generator_args} --build-project TargetName + --build-options ${build_options} --test-command ${CMAKE_CMAKE_COMMAND} -E compare_files ${CMake_SOURCE_DIR}/Tests/TargetName/scripts/hello_world ${CMake_BINARY_DIR}/Tests/TargetName/scripts/hello_world) @@ -569,6 +596,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ${build_generator_args} --build-project LibName --build-exe-dir "${CMake_BINARY_DIR}/Tests/LibName/lib" + --build-options ${build_options} --test-command foobar ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LibName") @@ -581,6 +609,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ${build_generator_args} --build-project CustComDepend --build-exe-dir "${CMake_BINARY_DIR}/Tests/CustComDepend/bin" + --build-options ${build_options} --test-command foo bar.c ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CustComDepend") @@ -592,6 +621,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ${build_generator_args} --build-project ArgumentExpansion --build-exe-dir "${CMake_BINARY_DIR}/Tests/ArgumentExpansion/bin" + --build-options ${build_options} ) set_tests_properties(ArgumentExpansion PROPERTIES FAIL_REGULAR_EXPRESSION "Unexpected: ") @@ -603,7 +633,9 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ "${CMake_BINARY_DIR}/Tests/GeneratorExpression" ${build_generator_args} --build-project GeneratorExpression - --build-options -DCMAKE_BUILD_TYPE=\${CTEST_CONFIGURATION_TYPE} + --build-options ${build_options} + -DCMAKE_BUILD_TYPE=\${CTEST_CONFIGURATION_TYPE} + --test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} -V ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/GeneratorExpression") @@ -615,6 +647,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ${build_generator_args} --build-project CustomCommand --build-exe-dir "${CMake_BINARY_DIR}/Tests/CustomCommand/bin" + --build-options ${build_options} --test-command CustomCommand ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CustomCommand") @@ -628,6 +661,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-two-config ${build_generator_args} --build-project TestWorkingDir + --build-options ${build_options} --test-command working ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CustomCommandWorkingDirectory") @@ -639,6 +673,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ # ${build_generator_args} # --build-project SimpleExclude # --build-two-config + # --build-options ${build_options} # --test-command t4 #--test-command "${CMAKE_COMMAND}" #"-DCONFIGURATION=\${CTEST_CONFIGURATION_TYPE}" @@ -652,6 +687,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ # ${build_generator_args} # --build-project SameName # --build-two-config +# --build-options ${build_options} # --test-command # "${CMake_BINARY_DIR}/Tests/SameName/Exe1/mytest2") @@ -662,6 +698,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ${build_generator_args} --build-project OutOfSource --build-two-config + --build-options ${build_options} --test-command "${CMake_BINARY_DIR}/Tests/OutOfSource/SubDir/OutOfSourceSubdir/simple") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/OutOfSource") @@ -674,6 +711,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ "${CMake_BINARY_DIR}/Tests/BuildDepends" ${build_generator_args} --build-project BuildDepends + --build-options ${build_options} ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BuildDepends") @@ -686,7 +724,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ${build_generator_args} --build-project TestSimpleInstall --build-two-config - --build-options + --build-options ${build_options} "-DCMAKE_INSTALL_PREFIX:PATH=${SimpleInstallInstallDir}" "-DCTEST_TEST_CPACK:BOOL=${CTEST_TEST_CPACK}" --test-command ${SimpleInstallInstallDir}/MyTest/bin/SimpleInstExe) @@ -698,12 +736,25 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ${build_generator_args} --build-project TestSimpleInstall --build-two-config - --build-options + --build-options ${build_options} "-DCMAKE_INSTALL_PREFIX:PATH=${SimpleInstallInstallDir}" "-DSTAGE2:BOOL=1" --test-command ${SimpleInstallInstallDir}/MyTest/bin/SimpleInstExeS2) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SimpleInstallS2") + set(MissingInstallInstallDir + "${CMake_BINARY_DIR}/Tests/MissingInstall/InstallDirectory") + add_test(MissingInstall ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/MissingInstall" + "${CMake_BINARY_DIR}/Tests/MissingInstall" + ${build_generator_args} + --build-project TestMissingInstall + --build-two-config + --build-options ${build_options} + "-DCMAKE_INSTALL_PREFIX:PATH=${MissingInstallInstallDir}") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/MissingInstall") + # By default, run the CPackComponents test if the CTEST_TEST_CPACK # option is ON: # @@ -752,6 +803,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ "${CMake_BINARY_DIR}/Tests/CPackWiXGenerator" ${build_generator_args} --build-project CPackWiXGenerator + --build-options ${build_options} --test-command ${CMAKE_CMAKE_COMMAND} "-DCPackWiXGenerator_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackWiXGenerator" -P "${CMake_SOURCE_DIR}/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake") @@ -759,12 +811,12 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ endif() if(CTEST_RUN_CPackComponents) - set(CPackComponents_EXTRA_OPTIONS) + set(CPackComponents_BUILD_OPTIONS) if(APPLE) - set(CPackComponents_EXTRA_OPTIONS -DCPACK_BINARY_DRAGNDROP:BOOL=ON) + set(CPackComponents_BUILD_OPTIONS -DCPACK_BINARY_DRAGNDROP:BOOL=ON) endif() if(NSIS_MAKENSIS_EXECUTABLE) - set(CPackComponents_EXTRA_OPTIONS ${CPackComponents_EXTRA_OPTIONS} + set(CPackComponents_BUILD_OPTIONS ${CPackComponents_BUILD_OPTIONS} -DCPACK_BINARY_NSIS:BOOL=ON) endif() @@ -776,10 +828,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-project CPackComponents --build-two-config --build-target package - --build-options + --build-options ${build_options} -DCPACK_BINARY_DEB:BOOL=${CPACK_BINARY_DEB} -DCPACK_BINARY_RPM:BOOL=${CPACK_BINARY_RPM} - ${CPackComponents_EXTRA_OPTIONS} + ${CPackComponents_BUILD_OPTIONS} --graphviz=CPackComponents.dot --test-command ${CMAKE_CMAKE_COMMAND} "-DCPackComponents_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackComponents" @@ -803,7 +855,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ # ACTIVE_CPACK_GENERATORS variable # now contains the list of 'active generators' - set(CPackComponentsForAll_EXTRA_OPTIONS) + set(CPackComponentsForAll_BUILD_OPTIONS) # set up list of CPack generators list(APPEND GENLST "ZIP") if(APPLE) @@ -835,10 +887,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ "${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/build${CPackGen}-${CPackComponentWay}" ${build_generator_args} --build-project CPackComponentsForAll - --build-options + --build-options ${build_options} -DCPACK_BINARY_${CPackGen}:BOOL=ON ${CPackRun_CPackComponentWay} - ${CPackComponentsForAll_EXTRA_OPTIONS} + ${CPackComponentsForAll_BUILD_OPTIONS} --graphviz=CPackComponentsForAll.dot --test-command ${CMAKE_CMAKE_COMMAND} "-DCPackComponentsForAll_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/build${CPackGen}-${CPackComponentWay}" @@ -872,6 +924,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ "${CMake_BINARY_DIR}/Tests/CPackTestAllGenerators" ${build_generator_args} --build-project CPackTestAllGenerators + --build-options ${build_options} --test-command ${CMAKE_CMAKE_COMMAND} -D dir=${CMake_BINARY_DIR}/Tests/CPackTestAllGenerators @@ -894,6 +947,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-project UseX11 --build-two-config ${X11_build_target_arg} + --build-options ${build_options} --test-command UseX11) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/X11") @@ -947,6 +1001,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ "${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig" ${build_generator_args} --build-project LoadCommand + --build-options ${build_options} --test-command LoadedCommand ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig") @@ -960,7 +1015,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ${build_generator_args} --build-project Complex --build-exe-dir "${CMake_BINARY_DIR}/Tests/Complex/bin" - --build-options + --build-options ${build_options} -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} --test-command complex ) @@ -973,7 +1028,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ${build_generator_args} --build-project Complex --build-exe-dir "${CMake_BINARY_DIR}/Tests/ComplexOneConfig/bin" - --build-options + --build-options ${build_options} -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} --test-command complex) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ComplexOneConfig") @@ -987,6 +1042,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ${build_generator_args} --build-project HELLO --build-exe-dir "${CMake_BINARY_DIR}/Example/Demo" + --build-options ${build_options} --test-command helloDemo ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Example") @@ -999,6 +1055,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-project EnvironmentProj --build-exe-dir "${CMake_BINARY_DIR}/Tests/Environment" --force-new-ctest-process + --build-options ${build_options} --test-command ${CMAKE_CTEST_COMMAND} -V ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Environment") @@ -1009,38 +1066,80 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ "${CMake_BINARY_DIR}/Tests/QtAutomocNoQt" ${build_generator_args} --build-project QtAutomocNoQt - --build-options -DCMAKE_BUILD_TYPE=\${CTEST_CONFIGURATION_TYPE} + --build-options ${build_options} + -DCMAKE_BUILD_TYPE=\${CTEST_CONFIGURATION_TYPE} ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/QtAutomocNoQt") + # On Windows there is no RPATH, so while Qt might be available for building, + # the required dlls may not be in the PATH, so we can't run the executables + # on that platform. + if(WIN32) + set(run_autogen_test ${CMAKE_CTEST_COMMAND} -V) + set(run_autouic_test ${CMAKE_CTEST_COMMAND} -V) + else() + set(run_autogen_test QtAutogen) + set(run_autouic_test QtAutoUicInterface) + endif() + find_package(Qt5Widgets QUIET NO_MODULE) if(Qt5Widgets_FOUND) - add_test(Qt5Automoc ${CMAKE_CTEST_COMMAND} + add_test(Qt5Autogen ${CMAKE_CTEST_COMMAND} --build-and-test - "${CMake_SOURCE_DIR}/Tests/QtAutomoc" - "${CMake_BINARY_DIR}/Tests/Qt5Automoc" + "${CMake_SOURCE_DIR}/Tests/QtAutogen" + "${CMake_BINARY_DIR}/Tests/Qt5Autogen" ${build_generator_args} - --build-project QtAutomoc - --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt5Automoc" + --build-project QtAutogen + --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt5Autogen" --force-new-ctest-process - --build-options -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=5 - --test-command ${CMAKE_CTEST_COMMAND} -V + --build-options ${build_options} + -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=5 + --test-command ${run_autogen_test} + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt5Autogen") + + add_test(Qt5AutoUicInterface ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/QtAutoUicInterface" + "${CMake_BINARY_DIR}/Tests/Qt5AutoUicInterface" + ${build_generator_args} + --build-project QtAutoUicInterface + --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt5AutoUicInterface" + --force-new-ctest-process + --build-options ${build_options} + -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=5 + --test-command ${run_autouic_test} ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt5Automoc") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt5AutoUicInterface") endif() if(QT4_WORKS AND QT_QTGUI_FOUND) - add_test(Qt4Automoc ${CMAKE_CTEST_COMMAND} + add_test(Qt4Autogen ${CMAKE_CTEST_COMMAND} --build-and-test - "${CMake_SOURCE_DIR}/Tests/QtAutomoc" - "${CMake_BINARY_DIR}/Tests/Qt4Automoc" + "${CMake_SOURCE_DIR}/Tests/QtAutogen" + "${CMake_BINARY_DIR}/Tests/Qt4Autogen" ${build_generator_args} - --build-project QtAutomoc - --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4Automoc" + --build-project QtAutogen + --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4Autogen" --force-new-ctest-process - --build-options -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=4 - --test-command ${CMAKE_CTEST_COMMAND} -V + --build-options ${build_options} + -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=4 + --test-command ${run_autogen_test} + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4Autogen") + + add_test(Qt4AutoUicInterface ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/QtAutoUicInterface" + "${CMake_BINARY_DIR}/Tests/Qt4AutoUicInterface" + ${build_generator_args} + --build-project QtAutoUicInterface + --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4AutoUicInterface" + --force-new-ctest-process + --build-options ${build_options} + -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=4 + --test-command ${run_autouic_test} ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4Automoc") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4AutoUicInterface") add_test(Qt4Targets ${CMAKE_CTEST_COMMAND} --build-and-test @@ -1050,7 +1149,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-project Qt4Targets --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4Targets" --force-new-ctest-process - --build-options -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} + --build-options ${build_options} + -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} --test-command ${CMAKE_CTEST_COMMAND} -V ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4Targets") @@ -1064,12 +1164,18 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-project Qt4And5Automoc --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4And5Automoc" --force-new-ctest-process + --build-options ${build_options} --test-command ${CMAKE_CTEST_COMMAND} -V ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4And5Automoc") endif() endif() + find_package(GTK2 QUIET) + if(GTK2_FOUND) + add_subdirectory(FindGTK2) + endif() + add_test(ExternalProject ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/ExternalProject" @@ -1078,6 +1184,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-project ExternalProjectTest --build-exe-dir "${CMake_BINARY_DIR}/Tests/ExternalProject" --force-new-ctest-process + --build-options ${build_options} --test-command ${CMAKE_CTEST_COMMAND} -V ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProject") @@ -1092,6 +1199,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-project ExternalProjectUpdateTest --build-exe-dir "${CMake_BINARY_DIR}/Tests/ExternalProjectUpdate" --force-new-ctest-process + --build-options ${build_options} --test-command ${CMAKE_CTEST_COMMAND} -V ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProjectUpdate") @@ -1104,7 +1212,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ -DExternalProjectUpdate_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/ExternalProjectUpdate -DCMAKE_TEST_GENERATOR=${CMAKE_TEST_GENERATOR} -DCMAKE_TEST_GENERATOR_TOOLSET=${CMAKE_TEST_GENERATOR_TOOLSET} - -DCMAKE_TEST_MAKEPROGRAM=${CMAKE_TEST_MAKEPROGRAM} -DCMAKE_CTEST_COMMAND=${CMAKE_CTEST_COMMAND} -P ${CMake_SOURCE_DIR}/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake ) @@ -1123,6 +1230,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-two-config ${build_generator_args} --build-project Tutorial + --build-options ${build_options} --test-command Tutorial 25.0) endforeach() list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Tutorial") @@ -1133,6 +1241,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ "${CMake_BINARY_DIR}/Tests/Testing" ${build_generator_args} --build-project Testing + --build-options ${build_options} --test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} ) set_tests_properties(testing PROPERTIES PASS_REGULAR_EXPRESSION "Passed") @@ -1145,6 +1254,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ${build_generator_args} --build-project Wrapping --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin" + --build-options ${build_options} --test-command wrapping ) add_test(qtwrapping ${CMAKE_CTEST_COMMAND} @@ -1154,6 +1264,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ${build_generator_args} --build-project Wrapping --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin" + --build-options ${build_options} --test-command qtwrapping ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Wrapping") @@ -1165,6 +1276,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ${build_generator_args} --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin" --build-project TestDriverTest + --build-options ${build_options} --test-command TestDriverTest test1 ) @@ -1175,6 +1287,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ${build_generator_args} --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin" --build-project TestDriverTest + --build-options ${build_options} --test-command TestDriverTest test2 ) @@ -1185,6 +1298,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ${build_generator_args} --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin" --build-project TestDriverTest + --build-options ${build_options} --test-command TestDriverTest subdir/test3 ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/TestDriver") @@ -1196,6 +1310,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-exe-dir "${CMake_BINARY_DIR}/Tests/Dependency/Exec" ${build_generator_args} --build-project Dependency + --build-options ${build_options} --test-command exec ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Dependency") @@ -1225,7 +1340,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-exe-dir "${CMake_BINARY_DIR}/Tests/Jump/WithLibOut/Executable" --build-project Jump ${build_generator_args} - --build-options + --build-options ${build_options} -DLIBRARY_OUTPUT_PATH:PATH=${CMake_BINARY_DIR}/Tests/Jump/WithLibOut/Lib --test-command jumpExecutable ) @@ -1238,6 +1353,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-run-dir "${CMake_BINARY_DIR}/Tests/Jump/NoLibOut/Executable" --build-project Jump ${build_generator_args} + --build-options ${build_options} --test-command jumpExecutable ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Jump") @@ -1249,6 +1365,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ${build_generator_args} --build-project Plugin --build-two-config + --build-options ${build_options} --test-command bin/example) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Plugin") @@ -1264,6 +1381,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ "${CMake_BINARY_DIR}/Tests/MacRuntimePath" ${build_generator_args} --build-project MacRuntimePath + --build-options ${build_options} + -DCMAKE_TEST_MAKEPROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM} ) endif() @@ -1273,6 +1392,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ "${CMake_BINARY_DIR}/Tests/LinkLineOrder" ${build_generator_args} --build-project LinkLineOrder + --build-options ${build_options} --test-command Exec1 ) @@ -1282,6 +1402,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ "${CMake_BINARY_DIR}/Tests/LinkLineOrder" ${build_generator_args} --build-project LinkLineOrder + --build-options ${build_options} --test-command Exec2 ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LinkLineOrder") @@ -1302,7 +1423,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ "${CMake_BINARY_DIR}/Tests/LinkStatic" ${build_generator_args} --build-project LinkStatic - --build-options -DMATH_LIBRARY:FILEPATH=/usr/lib/libm.a + --build-options ${build_options} + -DMATH_LIBRARY:FILEPATH=/usr/lib/libm.a --test-command LinkStatic ) endif() @@ -1314,6 +1436,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ "${CMake_BINARY_DIR}/Tests/kwsys" ${build_generator_args} --build-project kwsys + --build-options ${build_options} --test-command kwsysTestsCxx testIOS ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/kwsys") @@ -1328,6 +1451,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ "${CMake_BINARY_DIR}/Tests/SubDirSpaces/Executable Sources" ${build_generator_args} --build-project SUBDIR + --build-options ${build_options} --test-command test "${CMake_BINARY_DIR}/Tests/SubDirSpaces/ShouldBeHere" "${CMake_BINARY_DIR}/Tests/SubDirSpaces/testfromsubdir.obj" @@ -1343,6 +1467,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-exe-dir "${CMake_BINARY_DIR}/Tests/SubDir/Executable" ${build_generator_args} --build-project SUBDIR + --build-options ${build_options} --test-command test "${CMake_BINARY_DIR}/Tests/SubDir/ShouldBeHere" "${CMake_BINARY_DIR}/Tests/SubDir/testfromsubdir.obj" @@ -1355,6 +1480,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-exe-dir "${CMake_BINARY_DIR}/Tests/SubDir/Executable" ${build_generator_args} --build-project SUBDIR + --build-options ${build_options} --test-command test "${CMake_BINARY_DIR}/Tests/SubDir/ShouldBeHere" "${CMake_BINARY_DIR}/Tests/SubDir/testfromsubdir.o" @@ -1382,6 +1508,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ${build_generator_args} --build-project MakeClean --build-exe-dir "${CMake_BINARY_DIR}/MakeClean" + --build-options ${build_options} --test-command check_clean ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/MakeClean") @@ -1395,7 +1522,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ # Look for evidence that this is a VCExpress build. If so, avoid # the MFC test by default. - string(TOLOWER "${CMAKE_TEST_MAKEPROGRAM}" mkprog) + string(TOLOWER "${CMAKE_MAKE_PROGRAM};${CMAKE_TEST_MAKEPROGRAM}" mkprog) if(mkprog MATCHES "vcexpress") message(STATUS "CMAKE_TEST_MAKEPROGRAM indicates vcexpress, avoiding MFC test") @@ -1486,6 +1613,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-two-config ${build_generator_args} --build-project mfc_driver + --build-options ${build_options} --test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} -VV) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/MFC") @@ -1508,6 +1636,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-two-config ${build_generator_args} --build-project VSExternalInclude + --build-options ${build_options} --test-command VSExternalInclude) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSExternalInclude") @@ -1518,10 +1647,11 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-two-config ${build_generator_args} --build-project VSMidl + --build-options ${build_options} --test-command VSMidl) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSMidl") - if(NOT MSVC60 AND NOT CMAKE_TEST_MAKEPROGRAM MATCHES "[mM][sS][bB][uU][iI][lL][dD]\\.[eE][xX][eE]") + 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 @@ -1533,7 +1663,9 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ "${CMake_BINARY_DIR}/Tests/VSExcludeFromDefaultBuild" --build-config ${config} --build-two-config - ${build_generator_args} + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_DEVENV} + --build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}" --build-project VSExcludeFromDefaultBuild --test-command ${CMAKE_COMMAND} -D "activeConfig=${config}" @@ -1550,31 +1682,17 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ endif() if(CMAKE_TEST_GENERATOR MATCHES "Visual Studio ([0-5]|[6-9][0-9])") - if(CMAKE_TEST_MAKEPROGRAM MATCHES "[mM][sS][bB][uU][iI][lL][dD]\\.[eE][xX][eE]") - set(MSBUILD_EXECUTABLE "${CMAKE_TEST_MAKEPROGRAM}") - else() - if(CMAKE_TEST_GENERATOR MATCHES "Visual Studio (12)") - set(_msbuild_hints "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\${CMAKE_MATCH_1}.0;MSBuildToolsPath]") - else() - set(_FDIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7;FrameworkDir32]") - set(_FVER "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7;FrameworkVer32]") - set(_msbuild_hints ${_FDIR}/${_FVER}) - endif() - find_program(MSBUILD_EXECUTABLE NAMES msbuild HINTS ${_msbuild_hints}) - endif() - if(MSBUILD_EXECUTABLE) - add_test(NAME VSProjectInSubdir COMMAND ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/VSProjectInSubdir" - "${CMake_BINARY_DIR}/Tests/VSProjectInSubdir" - --build-two-config - --build-generator ${CMAKE_TEST_GENERATOR} - --build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}" - --build-makeprogram "${MSBUILD_EXECUTABLE}" - --build-project VSProjectInSubdir - --build-target test) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSProjectInSubdir") - endif() + # This is Visual Studio 10 or above, so the default build tool is MSBuild. + add_test(NAME VSProjectInSubdir COMMAND ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/VSProjectInSubdir" + "${CMake_BINARY_DIR}/Tests/VSProjectInSubdir" + --build-two-config + --build-generator ${CMAKE_TEST_GENERATOR} + --build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}" + --build-project VSProjectInSubdir + --build-target test) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSProjectInSubdir") endif() endif() @@ -1591,7 +1709,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-project BundleTest --build-target install # --build-target package - --build-options "-DCMAKE_INSTALL_PREFIX:PATH=${BundleTestInstallDir}" + --build-options ${build_options} + "-DCMAKE_INSTALL_PREFIX:PATH=${BundleTestInstallDir}" "-DCMake_SOURCE_DIR:PATH=${CMake_SOURCE_DIR}" --test-command ${BundleTestInstallDir}/Applications/SecondBundleExe.app/Contents/MacOS/SecondBundleExe) @@ -1604,6 +1723,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-two-config ${build_generator_args} --build-project CFBundleTest + --build-options ${build_options} --test-command ${CMAKE_CMAKE_COMMAND} -DCTEST_CONFIGURATION_TYPE=\${CTEST_CONFIGURATION_TYPE} -Ddir=${CMake_BINARY_DIR}/Tests/CFBundleTest @@ -1624,7 +1744,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ${build_generator_args} --build-project BundleGeneratorTest --build-target package - --build-options "-DCMAKE_INSTALL_PREFIX:PATH=${CMake_BINARY_DIR}/Tests/BundleGeneratorTest/InstallDirectory" + --build-options ${build_options} + "-DCMAKE_INSTALL_PREFIX:PATH=${CMake_BINARY_DIR}/Tests/BundleGeneratorTest/InstallDirectory" ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BundleGeneratorTest") endif() @@ -1636,7 +1757,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ${build_generator_args} --build-noclean --build-project WarnUnusedUnusedViaSet - --build-options "--warn-unused-vars") + --build-options ${build_options} + "--warn-unused-vars") set_tests_properties(WarnUnusedUnusedViaSet PROPERTIES PASS_REGULAR_EXPRESSION "unused variable \\(changing definition\\) 'UNUSED_VARIABLE'") set_tests_properties(WarnUnusedUnusedViaSet PROPERTIES @@ -1650,7 +1772,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ${build_generator_args} --build-noclean --build-project WarnUnusedUnusedViaUnset - --build-options "--warn-unused-vars") + --build-options ${build_options} + "--warn-unused-vars") set_tests_properties(WarnUnusedUnusedViaUnset PROPERTIES PASS_REGULAR_EXPRESSION "CMake Warning .*VariableUnusedViaUnset.CMakeLists.txt:7 \\(set\\):") set_tests_properties(WarnUnusedUnusedViaUnset PROPERTIES @@ -1669,7 +1792,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUnused" ${build_generator_args} --build-project WarnUnusedCliUnused - --build-options "-DUNUSED_CLI_VARIABLE=Unused") + --build-options ${build_options} + "-DUNUSED_CLI_VARIABLE=Unused") set_tests_properties(WarnUnusedCliUnused PROPERTIES PASS_REGULAR_EXPRESSION "CMake Warning:.*Manually-specified variables were not used by the project:.* UNUSED_CLI_VARIABLE") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUnused") @@ -1682,7 +1806,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ${build_generator_args} --build-noclean --build-project WarnUnusedCliUsed - --build-options "-DUSED_VARIABLE=Usage proven") + --build-options ${build_options} + "-DUSED_VARIABLE=Usage proven") set_tests_properties(WarnUnusedCliUsed PROPERTIES PASS_REGULAR_EXPRESSION "Usage proven") set_tests_properties(WarnUnusedCliUsed PROPERTIES @@ -1696,7 +1821,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ${build_generator_args} --build-noclean --build-project WarnUninitialized - --build-options "--warn-uninitialized") + --build-options ${build_options} + "--warn-uninitialized") set_tests_properties(WarnUninitialized PROPERTIES PASS_REGULAR_EXPRESSION "uninitialized variable 'USED_VARIABLE'") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUninitialized") @@ -1709,6 +1835,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-project TestsWorkingDirectoryProj --build-exe-dir "${CMake_BINARY_DIR}/Tests/TestsWorkingDirectory" --force-new-ctest-process + --build-options ${build_options} --test-command ${CMAKE_CTEST_COMMAND} -V -C \${CTEST_CONFIGURATION_TYPE} ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/TestsWorkingDirectory") @@ -1725,17 +1852,18 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ # ) # A test for ctest_build() with targets in subdirectories + set(ctest_configure_options) if(CMAKE_TEST_GENERATOR_TOOLSET) - set(CMAKE_TEST_GENERATOR_TOOLSET_SELECTION "-T;${CMAKE_TEST_GENERATOR_TOOLSET};") - else() - set(CMAKE_TEST_GENERATOR_TOOLSET_SELECTION) + list(APPEND ctest_configure_options -T ${CMAKE_TEST_GENERATOR_TOOLSET}) + endif() + if(CMAKE_TEST_MAKEPROGRAM) + list(APPEND ctest_configure_options -DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM}) endif() configure_file("${CMake_SOURCE_DIR}/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake" @ONLY) - unset(CMAKE_TEST_GENERATOR_TOOLSET_SELECTION) + unset(ctest_configure_options) add_test(CTest.BuildCommand.ProjectInSubdir - ${CMAKE_CTEST_COMMAND} -S "${CMake_BINARY_DIR}/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake" - -DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM}) + ${CMAKE_CTEST_COMMAND} -S "${CMake_BINARY_DIR}/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CTestBuildCommandProjectInSubdir/Nested") set(CTEST_TEST_UPDATE 1) @@ -1856,6 +1984,26 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateHG_DIR}") endif() + + # Test CTest Update with P4 + find_program(P4_EXECUTABLE NAMES p4) + find_program(P4D_EXECUTABLE NAMES p4d) + mark_as_advanced(P4_EXECUTABLE P4D_EXECUTABLE) + set(CTEST_TEST_UPDATE_P4 0) + if(P4_EXECUTABLE AND P4D_EXECUTABLE) + if(NOT "${P4_EXECUTABLE};${P4D_EXECUTABLE}" MATCHES "cygwin" OR UNIX) + set(CTEST_TEST_UPDATE_P4 1) + endif() + endif() + if(CTEST_TEST_UPDATE_P4) + set(CTestUpdateP4_DIR "CTest UpdateP4") + configure_file("${CMake_SOURCE_DIR}/Tests/CTestUpdateP4.cmake.in" + "${CMake_BINARY_DIR}/Tests/CTestUpdateP4.cmake" @ONLY) + add_test(CTest.UpdateP4 ${CMAKE_CMAKE_COMMAND} + -P "${CMake_BINARY_DIR}/Tests/CTestUpdateP4.cmake" + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateP4_DIR}") + endif() endif() configure_file( @@ -1893,6 +2041,17 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ PASS_REGULAR_EXPRESSION "Upload\\.xml") configure_file( + "${CMake_SOURCE_DIR}/Tests/CTestTestEmptyBinaryDirectory/test.cmake.in" + "${CMake_BINARY_DIR}/Tests/CTestTestEmptyBinaryDirectory/test.cmake" + @ONLY ESCAPE_QUOTES) + add_test(CTestTestEmptyBinaryDirectory ${CMAKE_CTEST_COMMAND} + -S "${CMake_BINARY_DIR}/Tests/CTestTestEmptyBinaryDirectory/test.cmake" -V + --output-log "${CMake_BINARY_DIR}/Tests/CTestTestEmptyBinaryDirectory/testOut.log" + ) + set_tests_properties(CTestTestEmptyBinaryDirectory PROPERTIES + PASS_REGULAR_EXPRESSION "TEST_SUCCESS") + + configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestConfigFileInBuildDir/test1.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir1/test1.cmake" @ONLY ESCAPE_QUOTES) @@ -1959,12 +2118,26 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ PASS_REGULAR_EXPRESSION "Process file.*XINDEX.m.*Total LOC:.*125.*Percentage Coverage: 85.60.*" ENVIRONMENT COVFILE=) - # Use macro, not function so that build can still be driven by CMake 2.4. - # After 2.6 is required, this could be a function without the extra 'set' - # calls. - # - macro(add_config_tests cfg) - set(cfg "${cfg}") + + # Adding a test case for Python Coverage + configure_file( + "${CMake_SOURCE_DIR}/Tests/PythonCoverage/coverage.xml.in" + "${CMake_BINARY_DIR}/Testing/PythonCoverage/coverage.xml") + configure_file( + "${CMake_SOURCE_DIR}/Tests/PythonCoverage/DartConfiguration.tcl.in" + "${CMake_BINARY_DIR}/Testing/PythonCoverage/DartConfiguration.tcl") + file(COPY "${CMake_SOURCE_DIR}/Tests/PythonCoverage/coveragetest" + DESTINATION "${CMake_BINARY_DIR}/Testing/PythonCoverage") + add_test(NAME CTestPythonCoverage + COMMAND cmake -E chdir + ${CMake_BINARY_DIR}/Testing/PythonCoverage + $<TARGET_FILE:ctest> -T Coverage --debug) + set_tests_properties(CTestPythonCoverage PROPERTIES + PASS_REGULAR_EXPRESSION + "Process file.*foo.py.*Total LOC:.*13.*Percentage Coverage: 84.62.*" + ENVIRONMENT COVFILE=) + + function(add_config_tests cfg) set(base "${CMake_BINARY_DIR}/Tests/CTestConfig") # Test -S script with a -C config arg to ctest: @@ -1988,7 +2161,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ add_test(CTestConfig.Dashboard.${cfg} ${CMAKE_CMAKE_COMMAND} -P "${base}/${cfg}-dashboard.cmake" -VV ) - endmacro() + endfunction() add_config_tests(Debug) add_config_tests(MinSizeRel) @@ -2008,6 +2181,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --output-log "${CMake_BINARY_DIR}/Tests/CTestConfig/ScriptWithArgs.log" ) + ADD_TEST_MACRO(CMakeCommands.add_compile_options add_compile_options) ADD_TEST_MACRO(CMakeCommands.target_link_libraries target_link_libraries) ADD_TEST_MACRO(CMakeCommands.target_include_directories target_include_directories) ADD_TEST_MACRO(CMakeCommands.target_compile_definitions target_compile_definitions) @@ -2056,8 +2230,32 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --output-log "${CMake_BINARY_DIR}/Tests/CTestTestParallel/testOutput.log" ) + configure_file( + "${CMake_SOURCE_DIR}/Tests/CTestTestSkipReturnCode/test.cmake.in" + "${CMake_BINARY_DIR}/Tests/CTestTestSkipReturnCode/test.cmake" + @ONLY ESCAPE_QUOTES) + add_test(CTestTestSkipReturnCode ${CMAKE_CTEST_COMMAND} + -S "${CMake_BINARY_DIR}/Tests/CTestTestSkipReturnCode/test.cmake" -V + --output-log "${CMake_BINARY_DIR}/Tests/CTestTestSkipReturnCode/testOutput.log" + -C \${CTEST_CONFIGURATION_TYPE} + ) + set_tests_properties(CTestTestSkipReturnCode PROPERTIES + PASS_REGULAR_EXPRESSION "CMakeV1 \\.* +Passed.*CMakeV2 \\.+\\*+Skipped") + + ADD_TEST_MACRO(CTestTestSerialInDepends ${CMAKE_CTEST_COMMAND} -j 4 + --output-on-failure -C "\${CTestTest_CONFIG}") + + ADD_TEST_MACRO(CTestTestMissingDependsExe ${CMAKE_CTEST_COMMAND} + --output-on-failure -C "\${CTestTest_CONFIG}") + set_tests_properties(CTestTestMissingDependsExe PROPERTIES + PASS_REGULAR_EXPRESSION "\\*\\*\\*Not Run" + ) + + ADD_TEST_MACRO(CTestTestSerialOrder ${CMAKE_CTEST_COMMAND} + --output-on-failure -C "\${CTestTest_CONFIG}") + if(NOT BORLAND) - set(CTestLimitDashJ_EXTRA_OPTIONS --force-new-ctest-process) + set(CTestLimitDashJ_CTEST_OPTIONS --force-new-ctest-process) add_test_macro(CTestLimitDashJ ${CMAKE_CTEST_COMMAND} -j 4 --output-on-failure -C "\${CTestTest_CONFIG}") endif() @@ -2139,6 +2337,13 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ set_tests_properties(CTestTestTimeout PROPERTIES PASS_REGULAR_EXPRESSION "TestTimeout *\\.+ *\\*\\*\\*Timeout.*CheckChild *\\.+ *Passed") + add_test( + NAME CTestTestRerunFailed + COMMAND ${CMAKE_CTEST_COMMAND} --rerun-failed) + set_tests_properties(CTestTestRerunFailed PROPERTIES + PASS_REGULAR_EXPRESSION "1/1 Test #1: TestTimeout" DEPENDS CTestTestTimeout + WORKING_DIRECTORY ${CMake_BINARY_DIR}/Tests/CTestTestTimeout) + configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestZeroTimeout/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestZeroTimeout/test.cmake" @@ -2198,20 +2403,11 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --output-log "${CMake_BINARY_DIR}/Tests/CTestTestFdSetSize/testOutput.log" ) - # Use macro, not function so that build can still be driven by CMake 2.4. - # After 2.6 is required, this could be a function without the extra 'set' - # calls. - # - macro(add_failed_submit_test name source build in out log regex) - # Have variables named source, build and drop_method because the - # configure_file call expects those variables to be defined. - # - set(source "${source}") - set(build "${build}") + function(add_failed_submit_test name source build in out log regex) configure_file("${in}" "${out}" @ONLY) add_test(${name} ${CMAKE_CTEST_COMMAND} -S "${out}" -V --output-log "${log}") set_tests_properties(${name} PROPERTIES PASS_REGULAR_EXPRESSION "${regex}") - endmacro() + endfunction() set(regex "(Problems when submitting via S*CP") set(regex "${regex}|Error message was: ") @@ -2279,6 +2475,17 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --output-log "${CMake_BINARY_DIR}/Tests/CTestTest2/testOutput.log" ) + if("${CMAKE_TEST_GENERATOR}" MATCHES "Makefiles" OR "${CMAKE_TEST_GENERATOR}" MATCHES "Ninja") + configure_file("${CMake_SOURCE_DIR}/Tests/CTestTestLaunchers/test.cmake.in" + "${CMake_BINARY_DIR}/Tests/CTestTestLaunchers/test.cmake" @ONLY ESCAPE_QUOTES) + add_test(CTestTestLaunchers ${CMAKE_CTEST_COMMAND} + -S "${CMake_BINARY_DIR}/Tests/CTestTestLaunchers/test.cmake" -V + --output-log "${CMake_BINARY_DIR}/Tests/CTestTestLaunchers/testOutput.log" + ) + set_tests_properties(CTestTestLaunchers PROPERTIES + PASS_REGULAR_EXPRESSION "CTEST_TEST_LAUNCHER_SUCCESS") + endif() + configure_file("${CMake_SOURCE_DIR}/Tests/CTestTestChecksum/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestChecksum/test.cmake" @ONLY ESCAPE_QUOTES) @@ -2323,16 +2530,12 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ endif() endif() if(bootstrap) - add_test(BootstrapTest ${CMAKE_CTEST_COMMAND} - --build-and-test - ${CMake_SOURCE_DIR} - ${CMake_BINARY_DIR}/Tests/BootstrapTest - --build-nocmake - --build-noclean - --build-makeprogram ${bootstrap} - --build-generator "${CMAKE_TEST_GENERATOR}" - --test-command - ${CMake_BINARY_DIR}/Tests/BootstrapTest/Bootstrap.cmk/cmake) + add_test(NAME BootstrapTest + COMMAND ${CMAKE_CMAKE_COMMAND} + -D "bootstrap=${bootstrap}" + -D "bin_dir=${CMake_BINARY_DIR}/Tests/BootstrapTest" + -P ${CMAKE_CURRENT_SOURCE_DIR}/BootstrapTest.cmake + ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BootstrapTest") # Make this test run early during parallel execution set_tests_properties(BootstrapTest PROPERTIES COST 5000) @@ -2353,6 +2556,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ${build_generator_args} --build-project testf --build-two-config + --build-options ${build_options} + -DCMAKE_TEST_MAKEPROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM} --test-command testf) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Fortran") @@ -2371,6 +2576,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ${build_generator_args} --build-project FortranC --build-two-config + --build-options ${build_options} --test-command CMakeFiles/FortranCInterface/FortranCInterface) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/FortranC") endif() @@ -2394,6 +2600,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-project hello --build-two-config --build-run-dir "${CMake_BINARY_DIR}/Tests/Java/" + --build-options ${build_options} --test-command ${JAVA_RUNTIME} -classpath hello.jar HelloWorld) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Java") endif() @@ -2413,7 +2620,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ "${CMake_BINARY_DIR}/Tests/SimpleCOnly_sdcc" ${build_generator_args} --build-project SimpleC - --build-options + --build-options ${build_options} "-DCMAKE_SYSTEM_NAME=Generic" "-DCMAKE_C_COMPILER=${SDCC_EXECUTABLE}") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SimpleCOnly_sdcc") @@ -2431,7 +2638,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ "${CMake_BINARY_DIR}/Tests/Simple_Mingw_Linux2Win" ${build_generator_args} --build-project Simple - --build-options + --build-options ${build_options} "-DCMAKE_SYSTEM_NAME=Windows" "-DCMAKE_C_COMPILER=${MINGW_CC_LINUX2WIN_EXECUTABLE}" "-DCMAKE_CXX_COMPILER=${MINGW_CXX_LINUX2WIN_EXECUTABLE}" @@ -2441,19 +2648,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ endif() endif() - if(UNIX) - string(COMPARE EQUAL "${CMAKE_INSTALL_PREFIX}" "${CMake_BINARY_DIR}/Tests/TestShellInstall/Prefix" - PREFIX_IS_FOR_TEST) - if(PREFIX_IS_FOR_TEST) - configure_file( - ${CMake_SOURCE_DIR}/Tests/TestInstall.sh.in - ${CMake_BINARY_DIR}/Tests/TestShellInstall/TestInstall.sh - @ONLY IMMEDIATE - ) - add_test(ShellInstall /bin/sh ${CMake_BINARY_DIR}/Tests/TestShellInstall/TestShellInstall.sh) - endif() - endif() - if(CMAKE_TEST_PROJECT_CSE_DIR) set(script "${CMAKE_TEST_PROJECT_CSE_DIR}/BuildProjectCSE.cmake") if(NOT EXISTS "${script}") @@ -2493,11 +2687,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ) endif() - add_test(CMakeWizardTest ${CMAKE_CMAKE_COMMAND} - -D build_dir:STRING=${CMAKE_CURRENT_BINARY_DIR}/CMakeWizardTest - -D source_dir:STRING=${CMAKE_CURRENT_SOURCE_DIR}/Tutorial/Step3 - -D CMAKE_CTEST_COMMAND:STRING=${CMAKE_CTEST_COMMAND} - -P ${CMAKE_CURRENT_SOURCE_DIR}/CMakeWizardTest.cmake) + add_test(NAME CMakeWizardTest COMMAND cmake -i) + set_property(TEST CMakeWizardTest PROPERTY PASS_REGULAR_EXPRESSION + "The \"cmake -i\" wizard mode is no longer supported.") + # If the cache variable CMAKE_CONTRACT_PROJECTS is set # then the dashboard will run a contract with CMake test of that # name. For example CMAKE_CONTRACT_PROJECTS = vtk542 would run @@ -2526,8 +2719,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ endforeach() if(TEST_CompileCommandOutput) - set(CompileCommandOutput_EXTRA_OPTIONS - --build-options -DMAKE_SUPPORTS_SPACES=${MAKE_SUPPORTS_SPACES}) + set(CompileCommandOutput_BUILD_OPTIONS + -DMAKE_SUPPORTS_SPACES=${MAKE_SUPPORTS_SPACES}) ADD_TEST_MACRO(CompileCommandOutput "${CMake_BINARY_DIR}/Tests/CMakeLib/runcompilecommands") endif() @@ -2539,6 +2732,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-two-config ${build_generator_args} --build-project IncludeDirectories + --build-options ${build_options} --test-command IncludeDirectories) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/IncludeDirectories") @@ -2549,6 +2743,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-two-config ${build_generator_args} --build-project InterfaceLinkLibraries + --build-options ${build_options} --test-command InterfaceLinkLibraries) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/InterfaceLinkLibraries") diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt index 739593c..691728a 100644 --- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt +++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt @@ -22,11 +22,18 @@ endmacro() set(DESIRED_QT_VERSION 4) set(NO_QT4_MODULES "Qt3" "KDE3") +# ignore everything that has it's own test in Tests/Module/ +file(GLOB OWN_TEST_MODULES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/../../Module/" "${CMAKE_CURRENT_SOURCE_DIR}/../../Module/Find*") +foreach(FIND_MODULE IN LISTS OWN_TEST_MODULES) + string(REGEX REPLACE "^Find" "" _MOD_NAME "${FIND_MODULE}") + list(APPEND NO_FIND_MODULES "${_MOD_NAME}") +endforeach() + # These modules are named Find*.cmake, but are nothing that works in # find_package(). -set(NO_FIND_MODULES "PackageHandleStandardArgs" "PackageMessage") +list(APPEND NO_FIND_MODULES "PackageHandleStandardArgs" "PackageMessage") -foreach(FIND_MODULE ${FIND_MODULES}) +foreach(FIND_MODULE IN LISTS FIND_MODULES) string(REGEX REPLACE ".*/Find(.*)\\.cmake$" "\\1" MODULE_NAME "${FIND_MODULE}") list(FIND NO_QT4_MODULES ${MODULE_NAME} NO_QT4_INDEX) diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt index be7ddbc..7586de6 100644 --- a/Tests/CMakeOnly/CMakeLists.txt +++ b/Tests/CMakeOnly/CMakeLists.txt @@ -19,6 +19,8 @@ add_CMakeOnly_test(CheckCXXCompilerFlag) add_CMakeOnly_test(CheckLanguage) +add_CMakeOnly_test(CheckStructHasMember) + add_CMakeOnly_test(CompilerIdC) add_CMakeOnly_test(CompilerIdCXX) if(CMAKE_Fortran_COMPILER) diff --git a/Tests/CMakeOnly/CheckStructHasMember/CMakeLists.txt b/Tests/CMakeOnly/CheckStructHasMember/CMakeLists.txt new file mode 100644 index 0000000..f06d5c3 --- /dev/null +++ b/Tests/CMakeOnly/CheckStructHasMember/CMakeLists.txt @@ -0,0 +1,93 @@ +cmake_minimum_required(VERSION 2.8) + +project(CheckStructHasMember) + +set(CMAKE_REQUIRED_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}") + +include(CheckStructHasMember) + +foreach(_config_type Release RelWithDebInfo MinSizeRel Debug) + set(CMAKE_TRY_COMPILE_CONFIGURATION ${_config_type}) + unset(CSHM_RESULT_S1_${_config_type} CACHE) + unset(CSHM_RESULT_S2_${_config_type} CACHE) + unset(CSHM_RESULT_S3_${_config_type} CACHE) + message(STATUS "Testing configuration ${_config_type}") + + check_struct_has_member("struct non_existent_struct" "foo" "cm_cshm.h" CSHM_RESULT_S1_${_config_type}) + check_struct_has_member("struct struct_with_member" "non_existent_member" "cm_cshm.h" CSHM_RESULT_S2_${_config_type}) + check_struct_has_member("struct struct_with_member" "member" "cm_cshm.h" CSHM_RESULT_S3_${_config_type}) + + if(CSHM_RESULT_S1_${_config_type} OR CSHM_RESULT_S2_${_config_type}) + message(SEND_ERROR "CheckStructHasMember reported a nonexistent member as existing in configuration ${_config_type}") + endif() + + if(NOT CSHM_RESULT_S3_${_config_type}) + message(SEND_ERROR "CheckStructHasMember did not report an existent member as existing in configuration ${_config_type}") + endif() +endforeach() + +foreach(_config_type Release RelWithDebInfo MinSizeRel Debug) + set(CMAKE_TRY_COMPILE_CONFIGURATION ${_config_type}) + unset(CSHM_RESULT_S1_${_config_type}_C CACHE) + unset(CSHM_RESULT_S2_${_config_type}_C CACHE) + unset(CSHM_RESULT_S3_${_config_type}_C CACHE) + message(STATUS "Testing configuration ${_config_type}") + + check_struct_has_member("struct non_existent_struct" "foo" "cm_cshm.h" CSHM_RESULT_S1_${_config_type}_C LANGUAGE C) + check_struct_has_member("struct struct_with_member" "non_existent_member" "cm_cshm.h" CSHM_RESULT_S2_${_config_type}_C LANGUAGE C) + check_struct_has_member("struct struct_with_member" "member" "cm_cshm.h" CSHM_RESULT_S3_${_config_type}_C LANGUAGE C) + + if(CSHM_RESULT_S1_${_config_type}_C OR CSHM_RESULT_S2_${_config_type}_C) + message(SEND_ERROR "CheckStructHasMember reported a nonexistent member as existing in configuration ${_config_type}") + endif() + + if(NOT CSHM_RESULT_S3_${_config_type}_C) + message(SEND_ERROR "CheckStructHasMember did not report an existent member as existing in configuration ${_config_type}") + endif() +endforeach() + +foreach(_config_type Release RelWithDebInfo MinSizeRel Debug) + set(CMAKE_TRY_COMPILE_CONFIGURATION ${_config_type}) + unset(CSHM_RESULT_S1_${_config_type}_CXX CACHE) + unset(CSHM_RESULT_S2_${_config_type}_CXX CACHE) + unset(CSHM_RESULT_S3_${_config_type}_CXX CACHE) + unset(CSHM_RESULT_C1_${_config_type}_CXX CACHE) + unset(CSHM_RESULT_C2_${_config_type}_CXX CACHE) + unset(CSHM_RESULT_C3_${_config_type}_CXX CACHE) + + message(STATUS "Testing configuration ${_config_type}") + + check_struct_has_member("non_existent_struct" "foo" "cm_cshm.h" CSHM_RESULT_S1_${_config_type}_CXX LANGUAGE CXX) + check_struct_has_member("struct_with_non_existent_members" "non_existent_member" "cm_cshm.h" CSHM_RESULT_S2_${_config_type}_CXX LANGUAGE CXX) + check_struct_has_member("struct struct_with_member" "member" "cm_cshm.h" CSHM_RESULT_S3_${_config_type}_CXX LANGUAGE CXX) + check_struct_has_member("ns::non_existent_class" "foo" "cm_cshm.hxx" CSHM_RESULT_C1_${_config_type}_CXX LANGUAGE CXX) + check_struct_has_member("ns::class_with_non_existent_members" "foo" "cm_cshm.hxx" CSHM_RESULT_C2_${_config_type}_CXX LANGUAGE CXX) + check_struct_has_member("ns::class_with_member" "foo" "cm_cshm.hxx" CSHM_RESULT_C3_${_config_type}_CXX LANGUAGE CXX) + + if(CSHM_RESULT_S1_${_config_type}_CXX OR CSHM_RESULT_S2_${_config_type}_CXX OR CSHM_RESULT_C1_${_config_type}_CXX OR CSHM_RESULT_C2_${_config_type}_CXX) + message(SEND_ERROR "CheckStructHasMember reported a nonexistent member as existing in configuration ${_config_type}") + endif() + + if(NOT CSHM_RESULT_S3_${_config_type}_CXX OR NOT CSHM_RESULT_C3_${_config_type}_CXX) + message(SEND_ERROR "CheckStructHasMember did not report an existent member as existing in configuration ${_config_type}") + endif() +endforeach() + + +set(CMAKE_TRY_COMPILE_CONFIGURATION ${CMAKE_BUILD_TYPE}) + +if (CMAKE_COMPILER_IS_GNUCC) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3") + unset(CSHM_RESULT_O3 CACHE) + unset(CSHM_RESULT_O3_C CACHE) + unset(CSHM_RESULT_O3_CXX CACHE) + message(STATUS "Testing with optimization -O3") + + check_struct_has_member("class_with_non_existent_members" foo "cm_cshm.h" CSHM_RESULT_O3) + check_struct_has_member("class_with_non_existent_members" foo "cm_cshm.h" CSHM_RESULT_O3_C LANGUAGE C) + check_struct_has_member("class_with_non_existent_members" foo "cm_cshm.h" CSHM_RESULT_O3_CXX LANGUAGE CXX) + + if (CSE_RESULT_O3 OR CSHM_RESULT_O3_C OR CSHM_RESULT_O3_CXX) + message(SEND_ERROR "CheckSymbolExists reported a nonexistent symbol as existing with optimization -O3") + endif () +endif () diff --git a/Tests/CMakeOnly/CheckStructHasMember/cm_cshm.h b/Tests/CMakeOnly/CheckStructHasMember/cm_cshm.h new file mode 100644 index 0000000..82bb049 --- /dev/null +++ b/Tests/CMakeOnly/CheckStructHasMember/cm_cshm.h @@ -0,0 +1,9 @@ +#ifndef _CSHM_DUMMY_H +#define _CSHM_DUMMY_H + +struct non_existent_struct; +struct struct_with_member{ + int member; +}; + +#endif diff --git a/Tests/CMakeOnly/CheckStructHasMember/cm_cshm.hxx b/Tests/CMakeOnly/CheckStructHasMember/cm_cshm.hxx new file mode 100644 index 0000000..458a99b --- /dev/null +++ b/Tests/CMakeOnly/CheckStructHasMember/cm_cshm.hxx @@ -0,0 +1,16 @@ +#ifndef _CSHM_DUMMY_HXX +#define _CSHM_DUMMY_HXX + +namespace ns { + +class non_existent_class; +class class_with_non_existent_members { +}; +class class_with_member { +public: + int foo; +}; + +} + +#endif diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt index 344b772..41714f6 100644 --- a/Tests/CMakeTests/CMakeLists.txt +++ b/Tests/CMakeTests/CMakeLists.txt @@ -3,7 +3,7 @@ set(CMAKE_EXECUTABLE "${CMake_BIN_DIR}/cmake") macro(AddCMakeTest TestName PreArgs) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${TestName}Test.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/${TestName}Test.cmake" @ONLY IMMEDIATE) + "${CMAKE_CURRENT_BINARY_DIR}/${TestName}Test.cmake" @ONLY) add_test(NAME CMake.${TestName} COMMAND ${CMAKE_EXECUTABLE} ${PreArgs} -P "${CMAKE_CURRENT_BINARY_DIR}/${TestName}Test.cmake" ${ARGN}) @@ -55,6 +55,15 @@ set(GetPrerequisites_PreArgs ) AddCMakeTest(GetPrerequisites "${GetPrerequisites_PreArgs}") +if(GIT_EXECUTABLE) + set(PolicyCheck_PreArgs + "-DCMake_BINARY_DIR:PATH=${CMake_BINARY_DIR}" + "-DCMake_SOURCE_DIR:PATH=${CMake_SOURCE_DIR}" + "-DGIT_EXECUTABLE:STRING=${GIT_EXECUTABLE}" + ) + AddCMakeTest(PolicyCheck "${PolicyCheck_PreArgs}") +endif() + # Run CheckSourceTree as the very last test in the CMake/CTest/CPack test # suite. It detects if any changes have been made to the CMake source tree # by any previous configure, build or test steps. diff --git a/Tests/CMakeTests/GetPropertyTest.cmake.in b/Tests/CMakeTests/GetPropertyTest.cmake.in index a858418..e99193e 100644 --- a/Tests/CMakeTests/GetPropertyTest.cmake.in +++ b/Tests/CMakeTests/GetPropertyTest.cmake.in @@ -11,17 +11,6 @@ if (NOT FOO_FULL STREQUAL "NOTFOUND") message(SEND_ERROR "property FOO has FULL_DOCS set to '${FOO_FULL}'") endif () -get_property(test_brief GLOBAL PROPERTY ENABLED_FEATURES BRIEF_DOCS) -get_property(test_full GLOBAL PROPERTY ENABLED_FEATURES FULL_DOCS) - -if(test_brief STREQUAL "NOTFOUND") - message(SEND_ERROR "property ENABLED_FEATURES has no BRIEF_DOCS") -endif() - -if(test_full STREQUAL "NOTFOUND") - message(SEND_ERROR "property ENABLED_FEATURES has no FULL_DOCS") -endif() - set(test_var alpha) get_property(result VARIABLE PROPERTY test_var) if(NOT result STREQUAL "alpha") diff --git a/Tests/CMakeTests/PolicyCheckTest.cmake.in b/Tests/CMakeTests/PolicyCheckTest.cmake.in new file mode 100644 index 0000000..416dc0a --- /dev/null +++ b/Tests/CMakeTests/PolicyCheckTest.cmake.in @@ -0,0 +1,154 @@ +# Check the CMake source tree for suspicious policy introdcutions... +# +message("=============================================================================") +message("CTEST_FULL_OUTPUT (Avoid ctest truncation of output)") +message("") +message("CMake_BINARY_DIR='${CMake_BINARY_DIR}'") +message("CMake_SOURCE_DIR='${CMake_SOURCE_DIR}'") +message("GIT_EXECUTABLE='${GIT_EXECUTABLE}'") +message("") + + +# If this does not appear to be a git checkout, just pass the test here +# and now. (Do not let the test fail if it is run in a tree *exported* from a +# repository or unpacked from a .zip file source installer...) +# +set(is_git_checkout 0) +if(EXISTS "${CMake_SOURCE_DIR}/.git") + set(is_git_checkout 1) +endif() + +message("is_git_checkout='${is_git_checkout}'") +message("") + +if(NOT is_git_checkout) + message("source tree is not a git checkout... test passes by early return...") + return() +endif() + +# If no GIT_EXECUTABLE, see if we can figure out which git was used +# for the ctest_update step on this dashboard... +# +if(is_git_checkout AND NOT GIT_EXECUTABLE) + set(ctest_ini_file "") + set(exe "") + + # Use the old name: + if(EXISTS "${CMake_BINARY_DIR}/DartConfiguration.tcl") + set(ctest_ini_file "${CMake_BINARY_DIR}/DartConfiguration.tcl") + endif() + + # But if it exists, prefer the new name: + if(EXISTS "${CMake_BINARY_DIR}/CTestConfiguration.ini") + set(ctest_ini_file "${CMake_BINARY_DIR}/CTestConfiguration.ini") + endif() + + # If there is a ctest ini file, read the update command or git command + # from it: + # + if(ctest_ini_file) + file(STRINGS "${ctest_ini_file}" line REGEX "^GITCommand: (.*)$") + string(REGEX REPLACE "^GITCommand: (.*)$" "\\1" line "${line}") + if("${line}" MATCHES "^\"") + string(REGEX REPLACE "^\"([^\"]+)\" *.*$" "\\1" line "${line}") + else() + string(REGEX REPLACE "^([^ ]+) *.*$" "\\1" line "${line}") + endif() + set(exe "${line}") + if("${exe}" STREQUAL "GITCOMMAND-NOTFOUND") + set(exe "") + endif() + if(exe) + message("info: GIT_EXECUTABLE set by 'GITCommand:' from '${ctest_ini_file}'") + endif() + + if(NOT exe) + file(STRINGS "${ctest_ini_file}" line REGEX "^UpdateCommand: (.*)$") + string(REGEX REPLACE "^UpdateCommand: (.*)$" "\\1" line "${line}") + if("${line}" MATCHES "^\"") + string(REGEX REPLACE "^\"([^\"]+)\" *.*$" "\\1" line "${line}") + else() + string(REGEX REPLACE "^([^ ]+) *.*$" "\\1" line "${line}") + endif() + set(exe "${line}") + if("${exe}" STREQUAL "GITCOMMAND-NOTFOUND") + set(exe "") + endif() + if(exe) + message("info: GIT_EXECUTABLE set by 'UpdateCommand:' from '${ctest_ini_file}'") + endif() + endif() + else() + message("info: no DartConfiguration.tcl or CTestConfiguration.ini file...") + endif() + + # If we have still not grokked the exe, look in the Update.xml file to see + # if we can parse it from there... + # + if(NOT exe) + file(GLOB_RECURSE update_xml_file "${CMake_BINARY_DIR}/Testing/Update.xml") + if(update_xml_file) + file(STRINGS "${update_xml_file}" line + REGEX "^.*<UpdateCommand>(.*)</UpdateCommand>$" LIMIT_COUNT 1) + string(REPLACE ""\;" "\"" line "${line}") + string(REGEX REPLACE "^.*<UpdateCommand>(.*)</UpdateCommand>$" "\\1" line "${line}") + if("${line}" MATCHES "^\"") + string(REGEX REPLACE "^\"([^\"]+)\" *.*$" "\\1" line "${line}") + else() + string(REGEX REPLACE "^([^ ]+) *.*$" "\\1" line "${line}") + endif() + if(line) + set(exe "${line}") + endif() + if(exe) + message("info: GIT_EXECUTABLE set by '<UpdateCommand>' from '${update_xml_file}'") + endif() + else() + message("info: no Update.xml file...") + endif() + endif() + + if(exe) + set(GIT_EXECUTABLE "${exe}") + message("GIT_EXECUTABLE='${GIT_EXECUTABLE}'") + message("") + + if(NOT EXISTS "${GIT_EXECUTABLE}") + message(FATAL_ERROR "GIT_EXECUTABLE does not exist...") + endif() + else() + message(FATAL_ERROR "could not determine GIT_EXECUTABLE...") + endif() +endif() + + +if(is_git_checkout AND GIT_EXECUTABLE) + # Check with "git grep" if there are any unacceptable cmPolicies additions + # + message("=============================================================================") + message("This is a git checkout, using git grep to verify no unacceptable policies") + message("are being introduced....") + message("") + + execute_process(COMMAND ${GIT_EXECUTABLE} grep -En "[0-9][0-9][0-9][0-9][0-9].*cmPolicies" + WORKING_DIRECTORY ${CMake_SOURCE_DIR} + OUTPUT_VARIABLE grep_output + OUTPUT_STRIP_TRAILING_WHITESPACE) + message("=== output of 'git grep -En \"[0-9][0-9][0-9][0-9][0-9].*cmPolicies\"' ===") + message("${grep_output}") + message("=== end output ===") + message("") + + if(NOT "${grep_output}" STREQUAL "") + message(FATAL_ERROR "git grep output is non-empty... +New CMake policies must be introduced in a non-date-based version number. +Send email to the cmake-developers list to figure out what the target +version number for this policy should be...") + endif() +endif() + + +# Still here? Good then... +# +message("test passes") +message("") diff --git a/Tests/CMakeWizardTest.cmake b/Tests/CMakeWizardTest.cmake deleted file mode 100644 index bcae8af..0000000 --- a/Tests/CMakeWizardTest.cmake +++ /dev/null @@ -1,52 +0,0 @@ -message("CTEST_FULL_OUTPUT (Avoid ctest truncation of output)") - -message(STATUS "build_dir='${build_dir}'") - -message(STATUS "source_dir='${source_dir}'") - - -execute_process(COMMAND ${CMAKE_COMMAND} -E - remove_directory ${build_dir} - TIMEOUT 5) - -execute_process(COMMAND ${CMAKE_COMMAND} -E - make_directory ${build_dir} - TIMEOUT 5) - -execute_process(COMMAND ${CMAKE_COMMAND} -E - copy_directory ${source_dir} ${build_dir}/src - TIMEOUT 5) - -execute_process(COMMAND ${CMAKE_COMMAND} -E - make_directory ${build_dir}/build - TIMEOUT 5) - -# This is enough to answer 32 questions with "the default answer is ok"... -# -file(WRITE ${build_dir}/input.txt - "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n") - - -message(STATUS "running wizard mode (cmake -i)...") - -execute_process(COMMAND ${CMAKE_COMMAND} -i ../src - INPUT_FILE ${build_dir}/input.txt - WORKING_DIRECTORY ${build_dir}/build - TIMEOUT 5 - ) - - -message(STATUS "building...") - -execute_process(COMMAND ${CMAKE_COMMAND} --build . - WORKING_DIRECTORY ${build_dir}/build - TIMEOUT 5 - ) - - -message(STATUS "testing...") - -execute_process(COMMAND ${CMAKE_CTEST_COMMAND} - WORKING_DIRECTORY ${build_dir}/build - TIMEOUT 5 - ) diff --git a/Tests/CPackComponentsForAll/CMakeLists.txt b/Tests/CPackComponentsForAll/CMakeLists.txt index 8162f0c..ff40e30 100644 --- a/Tests/CPackComponentsForAll/CMakeLists.txt +++ b/Tests/CPackComponentsForAll/CMakeLists.txt @@ -59,6 +59,7 @@ set(CPACK_PACKAGE_VERSION_MAJOR "1") set(CPACK_PACKAGE_VERSION_MINOR "0") set(CPACK_PACKAGE_VERSION_PATCH "2") set(CPACK_PACKAGE_INSTALL_DIRECTORY "CPack Component Example") +set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/license.txt) # Tell CPack all of the components to install. The "ALL" # refers to the fact that this is the set of components that @@ -120,4 +121,4 @@ if (NOT ("${CPackComponentWay}" STREQUAL "default")) set(CPACK_PROJECT_CONFIG_FILE ${CPackComponentsForAll_BINARY_DIR}/MyLibCPackConfig-${CPackComponentWay}.cmake) endif () # Include CPack to introduce the appropriate targets -include(CPack)
\ No newline at end of file +include(CPack) diff --git a/Tests/CPackComponentsForAll/license.txt b/Tests/CPackComponentsForAll/license.txt new file mode 100644 index 0000000..ba8ba48 --- /dev/null +++ b/Tests/CPackComponentsForAll/license.txt @@ -0,0 +1,3 @@ +LICENSE +------- +This is an installer created using CPack (http://www.cmake.org). No license provided. diff --git a/Tests/CPackWiXGenerator/CMakeLists.txt b/Tests/CPackWiXGenerator/CMakeLists.txt index 475e60d..bc3322e 100644 --- a/Tests/CPackWiXGenerator/CMakeLists.txt +++ b/Tests/CPackWiXGenerator/CMakeLists.txt @@ -4,19 +4,26 @@ project(CPackWiXGenerator) add_library(mylib mylib.cpp) -add_executable(mylibapp mylibapp.cpp) -target_link_libraries(mylibapp mylib) +add_executable(my-libapp mylibapp.cpp) +target_link_libraries(my-libapp mylib) + +add_executable(my-other-app myotherapp.cpp) install(TARGETS mylib ARCHIVE DESTINATION lib COMPONENT libraries) -install(TARGETS mylibapp +install(TARGETS my-libapp RUNTIME DESTINATION bin COMPONENT applications) +install(TARGETS my-other-app + RUNTIME + DESTINATION bin + COMPONENT applications2) + install(FILES mylib.h "file with spaces.h" DESTINATION include COMPONENT headers) @@ -36,7 +43,15 @@ set(CPACK_PACKAGE_INSTALL_DIRECTORY "CPack Component Example") set(CPACK_WIX_UPGRADE_GUID "BF20CE5E-7F7C-401D-8F7C-AB45E8D170E6") set(CPACK_WIX_UNINSTALL "1") -set(CPACK_PACKAGE_EXECUTABLES "mylibapp; CPack Wix Test") + +set(CPACK_PACKAGE_EXECUTABLES + "my-libapp" "CPack WiX Test" + "my-other-app" "Second CPack WiX Test" +) + +set(CPACK_WIX_PATCH_FILE "${CMAKE_CURRENT_SOURCE_DIR}/patch.xml") + +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/license.txt") include(CPack) @@ -50,11 +65,18 @@ cpack_add_component_group(Development DESCRIPTION "All of the tools you'll ever need to develop software") cpack_add_component(applications + REQUIRED DISPLAY_NAME "MyLib Application" DESCRIPTION "An extremely useful application that makes use of MyLib" GROUP Runtime INSTALL_TYPES Full) +cpack_add_component(applications2 + DISPLAY_NAME "MyLib Extra Application" + DESCRIPTION "Another extremely useful application that makes use of MyLib" + GROUP Runtime + INSTALL_TYPES Full) + cpack_add_component(documentation DISPLAY_NAME "MyLib Documentation" DESCRIPTION "The extensive suite of MyLib Application documentation files" diff --git a/Tests/CPackWiXGenerator/license.txt b/Tests/CPackWiXGenerator/license.txt new file mode 100644 index 0000000..7942783 --- /dev/null +++ b/Tests/CPackWiXGenerator/license.txt @@ -0,0 +1,9 @@ +hello world +merhaba dünya +ハローワールド +привет мир +مرحبا العالم +你好世界 + +4-Byte sequences: + Perch (Fish) 𩶘 Elevator 𨋢! diff --git a/Tests/CPackWiXGenerator/myotherapp.cpp b/Tests/CPackWiXGenerator/myotherapp.cpp new file mode 100644 index 0000000..c272dab --- /dev/null +++ b/Tests/CPackWiXGenerator/myotherapp.cpp @@ -0,0 +1 @@ +int main() {}
\ No newline at end of file diff --git a/Tests/CPackWiXGenerator/patch.xml b/Tests/CPackWiXGenerator/patch.xml new file mode 100644 index 0000000..13c392d --- /dev/null +++ b/Tests/CPackWiXGenerator/patch.xml @@ -0,0 +1,7 @@ +<CPackWiXPatch> + <CPackWiXFragment Id="CM_CP_applications.bin.my_libapp.exe"> + <Environment Id="MyEnvironment" Action="set" + Name="CPackWiXGeneratorTest" + Value="CPackWiXGeneratorTest"/> + </CPackWiXFragment> +</CPackWiXPatch> diff --git a/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake.in b/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake.in index ea48c78..abf010b 100644 --- a/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake.in +++ b/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake.in @@ -8,5 +8,5 @@ set(CTEST_BUILD_CONFIGURATION "@CTestTest_CONFIG@") ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY}) ctest_start(Experimental) -ctest_configure(OPTIONS "@CMAKE_TEST_GENERATOR_TOOLSET_SELECTION@-DCMAKE_MAKE_PROGRAM:FILEPATH=@CMAKE_TEST_MAKEPROGRAM@") +ctest_configure(OPTIONS "@ctest_configure_options@") ctest_build(TARGET test) diff --git a/Tests/CTestTest/test.cmake.in b/Tests/CTestTest/test.cmake.in index 214bff8..ab39b88 100644 --- a/Tests/CTestTest/test.cmake.in +++ b/Tests/CTestTest/test.cmake.in @@ -6,7 +6,7 @@ # this is the cvs module name that should be checked out set (CTEST_MODULE_NAME SmallAndFast) -# these are the the name of the source and binary directory on disk. +# these are the name of the source and binary directory on disk. # They will be appended to DASHBOARD_ROOT set (CTEST_SOURCE_NAME SmallAndFast) set (CTEST_BINARY_NAME SmallAndFastBuild) diff --git a/Tests/CTestTest2/test.cmake.in b/Tests/CTestTest2/test.cmake.in index 26a77a7..c5a7b45 100644 --- a/Tests/CTestTest2/test.cmake.in +++ b/Tests/CTestTest2/test.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestBadExe/test.cmake.in b/Tests/CTestTestBadExe/test.cmake.in index 03ebd04..a7420fc 100644 --- a/Tests/CTestTestBadExe/test.cmake.in +++ b/Tests/CTestTestBadExe/test.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestChecksum/test.cmake.in b/Tests/CTestTestChecksum/test.cmake.in index efc53fb..b18cdf3 100644 --- a/Tests/CTestTestChecksum/test.cmake.in +++ b/Tests/CTestTestChecksum/test.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestCostSerial/test.cmake.in b/Tests/CTestTestCostSerial/test.cmake.in index bfb3d9a..e2dda95 100644 --- a/Tests/CTestTestCostSerial/test.cmake.in +++ b/Tests/CTestTestCostSerial/test.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestCrash/test.cmake.in b/Tests/CTestTestCrash/test.cmake.in index 492966c..7ac1bb9 100644 --- a/Tests/CTestTestCrash/test.cmake.in +++ b/Tests/CTestTestCrash/test.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestCycle/test.cmake.in b/Tests/CTestTestCycle/test.cmake.in index e9c9a4e..94b9cac 100644 --- a/Tests/CTestTestCycle/test.cmake.in +++ b/Tests/CTestTestCycle/test.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestDepends/test.cmake.in b/Tests/CTestTestDepends/test.cmake.in index 002958b..98b2a27 100644 --- a/Tests/CTestTestDepends/test.cmake.in +++ b/Tests/CTestTestDepends/test.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestEmptyBinaryDirectory/test.cmake.in b/Tests/CTestTestEmptyBinaryDirectory/test.cmake.in new file mode 100644 index 0000000..8eb808f --- /dev/null +++ b/Tests/CTestTestEmptyBinaryDirectory/test.cmake.in @@ -0,0 +1,66 @@ +cmake_minimum_required(VERSION 2.8.12) + +set(CTEST_RUN_CURRENT_SCRIPT 0) + +set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestEmptyBinaryDirectory") +set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestEmptyBinaryDirectory") + +# make sure ctest does not remove directories without a CMakeCache.txt in it +set(EMPTY_BINARY_DIR "${CTEST_BINARY_DIRECTORY}/empty_binary_dir") +file(MAKE_DIRECTORY "${EMPTY_BINARY_DIR}") + +if(NOT EXISTS "${EMPTY_BINARY_DIR}" + OR EXISTS "${EMPTY_BINARY_DIR}/CMakeCache.txt") + message(FATAL_ERROR "empty_binary_dir precondition failed") +endif() + +ctest_empty_binary_directory("${EMPTY_BINARY_DIR}") + +if(NOT EXISTS "${EMPTY_BINARY_DIR}") + message(FATAL_ERROR "empty_binary_dir should not have been removed") +endif() + +# make sure ctest does remove directories with a CMakeCache.txt +set(VALID_BINARY_DIR "${CTEST_BINARY_DIRECTORY}/valid_binary_dir") +file(MAKE_DIRECTORY "${VALID_BINARY_DIR}") +file(WRITE "${VALID_BINARY_DIR}/CMakeCache.txt") + +if(NOT EXISTS "${VALID_BINARY_DIR}" + OR NOT EXISTS "${VALID_BINARY_DIR}/CMakeCache.txt") + message(FATAL_ERROR "valid_binary_dir precondition failed") +endif() + +ctest_empty_binary_directory("${VALID_BINARY_DIR}") + +if(EXISTS "${VALID_BINARY_DIR}") + message(FATAL_ERROR "valid_binary_dir should have been removed") +endif() + +# make sure ctest removes build directories recursively +set(DEEP_BINARY_DIR "${CTEST_BINARY_DIRECTORY}/deep_binary_dir") +file(MAKE_DIRECTORY "${DEEP_BINARY_DIR}") +file(WRITE "${DEEP_BINARY_DIR}/CMakeCache.txt") + +foreach(SUBDIR A Z A/A A/Z Z/A Z/Z) + set(FULL_SUBDIR "${DEEP_BINARY_DIR}/${SUBDIR}") + file(MAKE_DIRECTORY "${FULL_SUBDIR}") + + foreach(SUBFILE A.cpp Z.bat) + set(FULL_SUBFILE "${FULL_SUBDIR}/${SUBFILE}") + file(WRITE "${FULL_SUBFILE}" "I am '${FULL_SUBFILE}'") + endforeach() +endforeach() + +if(NOT EXISTS "${DEEP_BINARY_DIR}" + OR NOT EXISTS "${DEEP_BINARY_DIR}/CMakeCache.txt" + OR NOT EXISTS "${DEEP_BINARY_DIR}/Z/A/Z.bat") + message(FATAL_ERROR "deep_binary_dir precondition failed") +endif() + +ctest_empty_binary_directory("${DEEP_BINARY_DIR}") + +if(EXISTS "${DEEP_BINARY_DIR}") + message(FATAL_ERROR "deep_binary_dir should have been removed") +endif() + +message("TEST_SUCCESS") diff --git a/Tests/CTestTestFailure/testNoBuild.cmake.in b/Tests/CTestTestFailure/testNoBuild.cmake.in index 3c4d219..1dee1ae 100644 --- a/Tests/CTestTestFailure/testNoBuild.cmake.in +++ b/Tests/CTestTestFailure/testNoBuild.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestFailure/testNoExe.cmake.in b/Tests/CTestTestFailure/testNoExe.cmake.in index a133e2a..04e444d 100644 --- a/Tests/CTestTestFailure/testNoExe.cmake.in +++ b/Tests/CTestTestFailure/testNoExe.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestLaunchers/launcher_test_project/CMakeLists.txt b/Tests/CTestTestLaunchers/launcher_test_project/CMakeLists.txt new file mode 100644 index 0000000..06c5725 --- /dev/null +++ b/Tests/CTestTestLaunchers/launcher_test_project/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12) + +project(launcher_test_project) + +include(CTest) + +add_custom_command( + OUTPUT test1.txt + COMMAND ${CMAKE_COMMAND} + ARGS -DTESTID=1 -P "${CMAKE_CURRENT_SOURCE_DIR}/command.cmake" +) + +add_custom_command( + OUTPUT test2.txt + COMMAND ${CMAKE_COMMAND} + ARGS -DTESTID=2 -P "${CMAKE_CURRENT_SOURCE_DIR}/command.cmake" +) + +add_custom_target(mytarget ALL DEPENDS test1.txt test2.txt) diff --git a/Tests/CTestTestLaunchers/launcher_test_project/CTestConfig.cmake b/Tests/CTestTestLaunchers/launcher_test_project/CTestConfig.cmake new file mode 100644 index 0000000..bf404ab --- /dev/null +++ b/Tests/CTestTestLaunchers/launcher_test_project/CTestConfig.cmake @@ -0,0 +1,8 @@ +set(CTEST_USE_LAUNCHERS 1) +set(CTEST_PROJECT_NAME "CTestTestLaunchers") +set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT") +set(CTEST_DART_SERVER_VERSION "2") +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "www.cdash.org") +set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestLaunchers/launcher_test_project/command.cmake b/Tests/CTestTestLaunchers/launcher_test_project/command.cmake new file mode 100644 index 0000000..7f31af9 --- /dev/null +++ b/Tests/CTestTestLaunchers/launcher_test_project/command.cmake @@ -0,0 +1,5 @@ +if("${TESTID}" STREQUAL "1") + message("success") +elseif("${TESTID}" STREQUAL "2") + message(FATAL_ERROR "failure") +endif() diff --git a/Tests/CTestTestLaunchers/test.cmake.in b/Tests/CTestTestLaunchers/test.cmake.in new file mode 100644 index 0000000..43a6533 --- /dev/null +++ b/Tests/CTestTestLaunchers/test.cmake.in @@ -0,0 +1,39 @@ +cmake_minimum_required(VERSION 2.8.12) + +# Settings: +set(CTEST_DASHBOARD_SOURCE "@CMake_SOURCE_DIR@/Tests/CTestTestLaunchers") +set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTestLaunchers") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "Launchers-@BUILDNAME@-CTestTestLaunchers") + +set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_SOURCE}/launcher_test_project") +set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/launcher_test_project-bin") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") + +ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY}) + +file(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" " +CMAKE_CXX_FLAGS:STRING=@CMAKE_CXX_FLAGS@ +CMAKE_C_FLAGS:STRING=@CMAKE_C_FLAGS@ +CMAKE_C_COMPILER:STRING=@CMAKE_C_COMPILER@ +CMAKE_CXX_COMPILER:STRING=@CMAKE_CXX_COMPILER@ +CMAKE_C_COMPILER_ARG1:STRING=@CMAKE_C_COMPILER_ARG1@ +CMAKE_CXX_COMPILER_ARG1:STRING=@CMAKE_CXX_COMPILER_ARG1@ +") + +set(TEST_SUCCESS FALSE) + +ctest_start(Experimental) +ctest_configure(OPTIONS "-DCTEST_USE_LAUNCHERS=1") +ctest_build(NUMBER_ERRORS error_count) + +if("${error_count}" STREQUAL "1") + set(TEST_SUCCESS TRUE) +endif() + +if(TEST_SUCCESS) + message("CTEST_TEST_LAUNCHER_SUCCESS") +endif() diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt b/Tests/CTestTestMemcheck/CMakeLists.txt index 86d7385..9bd7249 100644 --- a/Tests/CTestTestMemcheck/CMakeLists.txt +++ b/Tests/CTestTestMemcheck/CMakeLists.txt @@ -1,5 +1,13 @@ REGEX_ESCAPE_STRING(CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}") +get_filename_component(CTEST_REALPATH_CMAKE_CURRENT_BINARY_DIR + "${CMAKE_CURRENT_BINARY_DIR}" REALPATH +) + +REGEX_ESCAPE_STRING(CTEST_ESCAPED_REALPATH_CMAKE_CURRENT_BINARY_DIR + "${CTEST_REALPATH_CMAKE_CURRENT_BINARY_DIR}" +) + foreach (_retval 0 1) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/memtester.cxx.in" "${CMAKE_CURRENT_BINARY_DIR}/ret${_retval}.cxx" @ONLY) endforeach () @@ -35,14 +43,31 @@ target_link_libraries(memcheck_fail CMakeLib) # same filenames. add_subdirectory(NoLogDummyChecker) -if (APPLE) - # filter out additional messages by Guard Malloc integrated in Xcode - set(GUARD_MALLOC_MSG "(ctest\([0-9]+\) malloc: [^\n]*\n)*") - set(NORMAL_CTEST_OUTPUT "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+\\.[0-9]+ sec\n${GUARD_MALLOC_MSG}\n${GUARD_MALLOC_MSG}100% tests passed, 0 tests failed out of 1\n.*\n-- Processing memory checking output: \n${GUARD_MALLOC_MSG}Memory checking results:\n${GUARD_MALLOC_MSG}") -else () - set(NORMAL_CTEST_OUTPUT "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+\\.[0-9]+ sec\n\n100% tests passed, 0 tests failed out of 1\n.*\n-- Processing memory checking output: \nMemory checking results:\n") -endif () -set(BULLSEYE_MSG "(BullseyeCoverage[^\n]*\n)?") +if(APPLE) + # filter out additional messages by Guard Malloc integrated in Xcode + set(guard_malloc_msg "ctest\\([0-9]+\\) malloc: ") + set(guard_malloc_lines "(${guard_malloc_msg}[^\n]*\n)*") + set(guard_malloc_output "${guard_malloc_msg}|") +else() + set(guard_malloc_msg "") + set(guard_malloc_lines "") + set(guard_malloc_output "") +endif() + +# When this entire test runs under coverage or memcheck tools +# they may add output to the end, so match known cases: +# - Bullseye adds a "BullseyeCoverage..." line. +# - Valgrind memcheck may add extra "==..." lines. +set(other_tool_output "((${guard_malloc_output}BullseyeCoverage|==)[^\n]*\n)*") + +string(REPLACE "\r\n" "\n" ctest_and_tool_outputs " +1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+\\.[0-9]+ sec +${guard_malloc_lines} +100% tests passed, 0 tests failed out of 1 +.* +-- Processing memory checking output:( ) +${guard_malloc_lines}Memory checking results: +${other_tool_output}") function(gen_mc_test_internal NAME CHECKER) set(SUBTEST_NAME "${NAME}") @@ -146,7 +171,7 @@ set_tests_properties(CTestTestMemcheckDummyValgrind CTestTestMemcheckDummyValgrindPrePost CTestTestMemcheckDummyPurify PROPERTIES - PASS_REGULAR_EXPRESSION "${NORMAL_CTEST_OUTPUT}${BULLSEYE_MSG}$") + PASS_REGULAR_EXPRESSION "${ctest_and_tool_outputs}$") foreach (_pp Pre Post) string(TOLOWER ${_pp} _pp_lower) @@ -157,13 +182,13 @@ endforeach () set_tests_properties(CTestTestMemcheckDummyValgrindIgnoreMemcheck PROPERTIES - PASS_REGULAR_EXPRESSION "\n2/2 Test #2: RunCMakeAgain .*${NORMAL_CTEST_OUTPUT}${BULLSEYE_MSG}$") + PASS_REGULAR_EXPRESSION "\n2/2 Test #2: RunCMakeAgain .*${ctest_and_tool_outputs}$") set_tests_properties(CTestTestMemcheckDummyBC PROPERTIES PASS_REGULAR_EXPRESSION "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+.[0-9]+ sec\n\n100% tests passed, 0 tests failed out of 1\n(.*\n)?Error parsing XML in stream at line 1: no element found\n") set_tests_properties(CTestTestMemcheckDummyValgrindInvalidSupFile PROPERTIES - PASS_REGULAR_EXPRESSION "\nCannot find memory checker suppression file: ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/does-not-exist\n") + PASS_REGULAR_EXPRESSION "\nCannot find memory checker suppression file: ${CTEST_ESCAPED_REALPATH_CMAKE_CURRENT_BINARY_DIR}/does-not-exist\n") set_tests_properties(CTestTestMemcheckDummyValgrindCustomOptions PROPERTIES PASS_REGULAR_EXPRESSION "\nCannot find memory tester output file: ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindCustomOptions/Testing/Temporary/MemoryChecker.1.log\n(.*\n)?Error in read script: ${CMAKE_CURRENT_BINARY_DIR}/DummyValgrindCustomOptions/test.cmake\n") diff --git a/Tests/CTestTestMissingDependsExe/CMakeLists.txt b/Tests/CTestTestMissingDependsExe/CMakeLists.txt new file mode 100644 index 0000000..9826da6 --- /dev/null +++ b/Tests/CTestTestMissingDependsExe/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8.12) + +project(CTestTestMissingDependsExe) + +enable_testing() + +add_test(test1 ${CMAKE_COMMAND} -E echo test) +add_test(test2 non-existent-command) + +set_tests_properties(test1 PROPERTIES DEPENDS test2) diff --git a/Tests/CTestTestParallel/test.cmake.in b/Tests/CTestTestParallel/test.cmake.in index a0d9fb3..5826342 100644 --- a/Tests/CTestTestParallel/test.cmake.in +++ b/Tests/CTestTestParallel/test.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestResourceLock/test.cmake.in b/Tests/CTestTestResourceLock/test.cmake.in index 1e7e344..f69b519 100644 --- a/Tests/CTestTestResourceLock/test.cmake.in +++ b/Tests/CTestTestResourceLock/test.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestScheduler/test.cmake.in b/Tests/CTestTestScheduler/test.cmake.in index 8ad6137..26d8058 100644 --- a/Tests/CTestTestScheduler/test.cmake.in +++ b/Tests/CTestTestScheduler/test.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestSerialInDepends/CMakeLists.txt b/Tests/CTestTestSerialInDepends/CMakeLists.txt new file mode 100644 index 0000000..90e50f9 --- /dev/null +++ b/Tests/CTestTestSerialInDepends/CMakeLists.txt @@ -0,0 +1,23 @@ +cmake_minimum_required(VERSION 2.8.12) + +project(CTestTestSerialInDepends) + +enable_testing() + +function(my_add_test NAME COST) + add_test(NAME ${NAME} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${CMAKE_CTEST_COMMAND} -DTEST_NAME=${NAME} + -S ${CMAKE_CURRENT_SOURCE_DIR}/test.ctest) + set_tests_properties(${NAME} PROPERTIES COST ${COST}) +endfunction() + +my_add_test(i_like_company 1000) +my_add_test(i_like_company_too 0) + +my_add_test(i_have_dependencies 1000) +set_tests_properties(i_have_dependencies PROPERTIES + DEPENDS "i_want_to_be_alone") + +my_add_test(i_want_to_be_alone 100) +set_tests_properties(i_want_to_be_alone PROPERTIES RUN_SERIAL 1) diff --git a/Tests/CTestTestSerialInDepends/test.ctest b/Tests/CTestTestSerialInDepends/test.ctest new file mode 100644 index 0000000..28ee094 --- /dev/null +++ b/Tests/CTestTestSerialInDepends/test.ctest @@ -0,0 +1,16 @@ +set(CTEST_RUN_CURRENT_SCRIPT 0) + +set(LOCK_FILE "${TEST_NAME}.lock") + +if("${TEST_NAME}" STREQUAL "i_want_to_be_alone") + file(GLOB LOCK_FILES *.lock) + if(LOCK_FILES) + message(FATAL_ERROR "found lock files of other tests even though this test should be running by itself: ${LOCK_FILES}") + endif() +endif() + +file(WRITE "${LOCK_FILE}") +ctest_sleep(3) +file(REMOVE "${LOCK_FILE}") + +return() diff --git a/Tests/CTestTestSerialOrder/CMakeLists.txt b/Tests/CTestTestSerialOrder/CMakeLists.txt new file mode 100644 index 0000000..69c11fc --- /dev/null +++ b/Tests/CTestTestSerialOrder/CMakeLists.txt @@ -0,0 +1,40 @@ +cmake_minimum_required(VERSION 2.8.12) + +project(CTestTestSerialOrder) + +set(TEST_OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/test_output.txt") + +enable_testing() + +function(add_serial_order_test TEST_NAME) + add_test(NAME ${TEST_NAME} + COMMAND ${CMAKE_COMMAND} + "-DTEST_OUTPUT_FILE=${TEST_OUTPUT_FILE}" + "-DTEST_NAME=${TEST_NAME}" + -P "${CMAKE_CURRENT_SOURCE_DIR}/test.cmake" + ) + + if(ARGC GREATER 1) + set_tests_properties(${TEST_NAME} PROPERTIES ${ARGN}) + endif() +endfunction() + +add_serial_order_test(initialization COST 1000) +add_serial_order_test(test1) +add_serial_order_test(test2) +add_serial_order_test(test3) +add_serial_order_test(test4 DEPENDS test5) + +add_serial_order_test(test5) +set_tests_properties(test5 PROPERTIES DEPENDS "test6;test7b;test7a") + +add_serial_order_test(test6 COST -2) +add_serial_order_test(test7a COST -1) +add_serial_order_test(test7b COST -1) +add_serial_order_test(test8 COST 10) +add_serial_order_test(test9 COST 20) +add_serial_order_test(test10 COST 0) +add_serial_order_test(test11) +add_serial_order_test(test12 COST 0) + +add_serial_order_test(verification COST -1000) diff --git a/Tests/CTestTestSerialOrder/test.cmake b/Tests/CTestTestSerialOrder/test.cmake new file mode 100644 index 0000000..8479cae --- /dev/null +++ b/Tests/CTestTestSerialOrder/test.cmake @@ -0,0 +1,31 @@ +list(APPEND EXPECTED_OUTPUT + initialization + test9 + test8 + test1 + test2 + test3 + test6 + test7a + test7b + test5 + test4 + test10 + test11 + test12 +) + + +if("${TEST_NAME}" STREQUAL "initialization") + file(WRITE ${TEST_OUTPUT_FILE} "${TEST_NAME}") + +elseif("${TEST_NAME}" STREQUAL "verification") + file(READ ${TEST_OUTPUT_FILE} ACTUAL_OUTPUT) + if(NOT "${ACTUAL_OUTPUT}" STREQUAL "${EXPECTED_OUTPUT}") + message(FATAL_ERROR "Actual test order [${ACTUAL_OUTPUT}] differs from expected test order [${EXPECTED_OUTPUT}]") + endif() + +else() + file(APPEND ${TEST_OUTPUT_FILE} ";${TEST_NAME}") + +endif() diff --git a/Tests/CTestTestSkipReturnCode/CMakeLists.txt b/Tests/CTestTestSkipReturnCode/CMakeLists.txt new file mode 100644 index 0000000..26c4178 --- /dev/null +++ b/Tests/CTestTestSkipReturnCode/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 2.8.12) +project(CTestTestSkipReturnCode) +include(CTest) + +add_test (NAME CMakeV1 COMMAND ${CMAKE_COMMAND} "--version") +add_test (NAME CMakeV2 COMMAND ${CMAKE_COMMAND} "--version") + +set_tests_properties(CMakeV2 PROPERTIES SKIP_RETURN_CODE 0) diff --git a/Tests/CTestTestSkipReturnCode/CTestConfig.cmake b/Tests/CTestTestSkipReturnCode/CTestConfig.cmake new file mode 100644 index 0000000..ad8e00e --- /dev/null +++ b/Tests/CTestTestSkipReturnCode/CTestConfig.cmake @@ -0,0 +1,7 @@ +set (CTEST_PROJECT_NAME "CTestTestSkipReturnCode") +set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") +set (CTEST_DART_SERVER_VERSION "2") +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "www.cdash.org") +set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestSkipReturnCode/test.cmake.in b/Tests/CTestTestSkipReturnCode/test.cmake.in new file mode 100644 index 0000000..ebee01b --- /dev/null +++ b/Tests/CTestTestSkipReturnCode/test.cmake.in @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 2.4) + +# Settings: +set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-SkipReturnCode") + +set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestSkipReturnCode") +set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestSkipReturnCode") +set(CTEST_CVS_COMMAND "@CVSCOMMAND@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") + +#CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) + +CTEST_START(Experimental) +CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestTestStopTime/GetDate.cmake b/Tests/CTestTestStopTime/GetDate.cmake index 60f1e0c..edc6519 100644 --- a/Tests/CTestTestStopTime/GetDate.cmake +++ b/Tests/CTestTestStopTime/GetDate.cmake @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.2) +cmake_minimum_required(VERSION 2.8.11) macro(GET_DATE) # @@ -13,10 +13,7 @@ macro(GET_DATE) # ${GD_PREFIX}PREFIX (if '${GD_PREFIX}' is not 'GD_'...!) # ${GD_PREFIX}VERBOSE # - # ${GD_PREFIX}CMD - # ${GD_PREFIX}ARGS # ${GD_PREFIX}OV - # ${GD_PREFIX}RV # # ${GD_PREFIX}REGEX # ${GD_PREFIX}YEAR @@ -25,8 +22,6 @@ macro(GET_DATE) # ${GD_PREFIX}HOUR # ${GD_PREFIX}MINUTE # ${GD_PREFIX}SECOND - # ${GD_PREFIX}FRACTIONAL_SECOND - # ${GD_PREFIX}DAY_OF_WEEK # # Caller can then use these variables to construct names based on # date and time stamps... @@ -51,31 +46,10 @@ macro(GET_DATE) # Retrieve the current date and time in the format: # - # Thu 01/12/2006 8:55:12.01 - # dow mm/dd/YYYY HH:MM:SS.ssssss + # 01/12/2006 08:55:12 + # mm/dd/YYYY HH:MM:SS # - # Use "echo %DATE% %TIME%" on Windows. - # Otherwise, try "date" as implemented on most Unix flavors. - # - if(WIN32) - # - # Use "cmd" shell with %DATE% and %TIME% support... - # May need adjustment in different locales or for custom date/time formats - # set in the Windows Control Panel. - # - set(${GD_PREFIX}CMD "cmd") - set(${GD_PREFIX}ARGS "/c echo %DATE% %TIME%") - else() - # - # Match the format returned by default in US English Windows: - # - set(${GD_PREFIX}CMD "date") - set(${GD_PREFIX}ARGS "\"+%a %m/%d/%Y %H:%M:%S.00\"") - endif() - - exec_program("${${GD_PREFIX}CMD}" "." ARGS "${${GD_PREFIX}ARGS}" - OUTPUT_VARIABLE ${GD_PREFIX}OV RETURN_VALUE ${GD_PREFIX}RV - ) + string(TIMESTAMP "${GD_PREFIX}OV" "%m/%d/%Y %H:%M:%S") if(${GD_PREFIX}VERBOSE) message(STATUS "") @@ -87,114 +61,39 @@ macro(GET_DATE) endif() message(STATUS "${GD_PREFIX}VERBOSE='${${GD_PREFIX}VERBOSE}'") message(STATUS "") - message(STATUS "${GD_PREFIX}CMD='${${GD_PREFIX}CMD}'") - message(STATUS "${GD_PREFIX}ARGS='${${GD_PREFIX}ARGS}'") message(STATUS "${GD_PREFIX}OV='${${GD_PREFIX}OV}'") - message(STATUS "${GD_PREFIX}RV='${${GD_PREFIX}RV}'") message(STATUS "") endif() - if("${${GD_PREFIX}RV}" STREQUAL "0") - # - # Extract eight individual components by matching a regex with paren groupings. - # Use the replace functionality and \\1 thru \\8 to extract components. - # - set(${GD_PREFIX}REGEX "([^ ]+) +([^/]+)/([^/]+)/([^ ]+) +([^:]+):([^:]+):([^\\.]+)\\.(.*)") - - string(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\1" ${GD_PREFIX}DAY_OF_WEEK "${${GD_PREFIX}OV}") - string(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\2" ${GD_PREFIX}MONTH "${${GD_PREFIX}OV}") - string(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\3" ${GD_PREFIX}DAY "${${GD_PREFIX}OV}") - string(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\4" ${GD_PREFIX}YEAR "${${GD_PREFIX}OV}") - string(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\5" ${GD_PREFIX}HOUR "${${GD_PREFIX}OV}") - string(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\6" ${GD_PREFIX}MINUTE "${${GD_PREFIX}OV}") - string(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\7" ${GD_PREFIX}SECOND "${${GD_PREFIX}OV}") - string(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\8" ${GD_PREFIX}FRACTIONAL_SECOND "${${GD_PREFIX}OV}") - - # - # Verify that extracted components don't have anything obviously - # wrong with them... Emit warnings if something looks suspicious... - # - - # Expecting a four digit year: - # - if(NOT "${${GD_PREFIX}YEAR}" MATCHES "^[0-9][0-9][0-9][0-9]$") - message(STATUS "WARNING: Extracted ${GD_PREFIX}YEAR='${${GD_PREFIX}YEAR}' is not a four digit number...") - endif() - - # Expecting month to be <= 12: - # - if(${${GD_PREFIX}MONTH} GREATER 12) - message(STATUS "WARNING: Extracted ${GD_PREFIX}MONTH='${${GD_PREFIX}MONTH}' is greater than 12!") - endif() - - # Expecting day to be <= 31: - # - if(${${GD_PREFIX}DAY} GREATER 31) - message(STATUS "WARNING: Extracted ${GD_PREFIX}DAY='${${GD_PREFIX}DAY}' is greater than 31!") - endif() - - # Expecting hour to be <= 23: - # - if(${${GD_PREFIX}HOUR} GREATER 23) - message(STATUS "WARNING: Extracted ${GD_PREFIX}HOUR='${${GD_PREFIX}HOUR}' is greater than 23!") - endif() - - # Expecting minute to be <= 59: - # - if(${${GD_PREFIX}MINUTE} GREATER 59) - message(STATUS "WARNING: Extracted ${GD_PREFIX}MINUTE='${${GD_PREFIX}MINUTE}' is greater than 59!") - endif() - - # Expecting second to be <= 59: - # - if(${${GD_PREFIX}SECOND} GREATER 59) - message(STATUS "WARNING: Extracted ${GD_PREFIX}SECOND='${${GD_PREFIX}SECOND}' is greater than 59!") - endif() + # + # Extract six individual components by matching a regex with paren groupings. + # Use the replace functionality and \\1 thru \\6 to extract components. + # + set(${GD_PREFIX}REGEX "([^/]+)/([^/]+)/([^ ]+) +([^:]+):([^:]+):([^\\.]+)") - # If individual components are single digit, - # prepend a leading zero: - # - if("${${GD_PREFIX}YEAR}" MATCHES "^[0-9]$") - set(${GD_PREFIX}YEAR "0${${GD_PREFIX}YEAR}") - endif() - if("${${GD_PREFIX}MONTH}" MATCHES "^[0-9]$") - set(${GD_PREFIX}MONTH "0${${GD_PREFIX}MONTH}") - endif() - if("${${GD_PREFIX}DAY}" MATCHES "^[0-9]$") - set(${GD_PREFIX}DAY "0${${GD_PREFIX}DAY}") - endif() - if("${${GD_PREFIX}HOUR}" MATCHES "^[0-9]$") - set(${GD_PREFIX}HOUR "0${${GD_PREFIX}HOUR}") - endif() - if("${${GD_PREFIX}MINUTE}" MATCHES "^[0-9]$") - set(${GD_PREFIX}MINUTE "0${${GD_PREFIX}MINUTE}") - endif() - if("${${GD_PREFIX}SECOND}" MATCHES "^[0-9]$") - set(${GD_PREFIX}SECOND "0${${GD_PREFIX}SECOND}") - endif() + string(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\1" ${GD_PREFIX}MONTH "${${GD_PREFIX}OV}") + string(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\2" ${GD_PREFIX}DAY "${${GD_PREFIX}OV}") + string(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\3" ${GD_PREFIX}YEAR "${${GD_PREFIX}OV}") + string(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\4" ${GD_PREFIX}HOUR "${${GD_PREFIX}OV}") + string(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\5" ${GD_PREFIX}MINUTE "${${GD_PREFIX}OV}") + string(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\6" ${GD_PREFIX}SECOND "${${GD_PREFIX}OV}") - if(${GD_PREFIX}VERBOSE) - message(STATUS "${GD_PREFIX}REGEX='${${GD_PREFIX}REGEX}'") - message(STATUS "${GD_PREFIX}YEAR='${${GD_PREFIX}YEAR}'") - message(STATUS "${GD_PREFIX}MONTH='${${GD_PREFIX}MONTH}'") - message(STATUS "${GD_PREFIX}DAY='${${GD_PREFIX}DAY}'") - message(STATUS "${GD_PREFIX}HOUR='${${GD_PREFIX}HOUR}'") - message(STATUS "${GD_PREFIX}MINUTE='${${GD_PREFIX}MINUTE}'") - message(STATUS "${GD_PREFIX}SECOND='${${GD_PREFIX}SECOND}'") - message(STATUS "${GD_PREFIX}FRACTIONAL_SECOND='${${GD_PREFIX}FRACTIONAL_SECOND}'") - message(STATUS "${GD_PREFIX}DAY_OF_WEEK='${${GD_PREFIX}DAY_OF_WEEK}'") - message(STATUS "") - message(STATUS "Counters that change...") - message(STATUS "") - message(STATUS "...very very quickly : ${${GD_PREFIX}YEAR}${${GD_PREFIX}MONTH}${${GD_PREFIX}DAY}${${GD_PREFIX}HOUR}${${GD_PREFIX}MINUTE}${${GD_PREFIX}SECOND}${${GD_PREFIX}FRACTIONAL_SECOND}") - message(STATUS " every second : ${${GD_PREFIX}YEAR}${${GD_PREFIX}MONTH}${${GD_PREFIX}DAY}${${GD_PREFIX}HOUR}${${GD_PREFIX}MINUTE}${${GD_PREFIX}SECOND}") - message(STATUS " daily : ${${GD_PREFIX}YEAR}${${GD_PREFIX}MONTH}${${GD_PREFIX}DAY}") - message(STATUS " monthly : ${${GD_PREFIX}YEAR}${${GD_PREFIX}MONTH}") - message(STATUS " annually : ${${GD_PREFIX}YEAR}") - message(STATUS "") - endif() - else() - message(SEND_ERROR "ERROR: macro(GET_DATE) failed. ${GD_PREFIX}CMD='${${GD_PREFIX}CMD}' ${GD_PREFIX}ARGS='${${GD_PREFIX}ARGS}' ${GD_PREFIX}OV='${${GD_PREFIX}OV}' ${GD_PREFIX}RV='${${GD_PREFIX}RV}'") + if(${GD_PREFIX}VERBOSE) + message(STATUS "${GD_PREFIX}REGEX='${${GD_PREFIX}REGEX}'") + message(STATUS "${GD_PREFIX}YEAR='${${GD_PREFIX}YEAR}'") + message(STATUS "${GD_PREFIX}MONTH='${${GD_PREFIX}MONTH}'") + message(STATUS "${GD_PREFIX}DAY='${${GD_PREFIX}DAY}'") + message(STATUS "${GD_PREFIX}HOUR='${${GD_PREFIX}HOUR}'") + message(STATUS "${GD_PREFIX}MINUTE='${${GD_PREFIX}MINUTE}'") + message(STATUS "${GD_PREFIX}SECOND='${${GD_PREFIX}SECOND}'") + message(STATUS "") + message(STATUS "Counters that change...") + message(STATUS "") + message(STATUS " every second : ${${GD_PREFIX}YEAR}${${GD_PREFIX}MONTH}${${GD_PREFIX}DAY}${${GD_PREFIX}HOUR}${${GD_PREFIX}MINUTE}${${GD_PREFIX}SECOND}") + message(STATUS " daily : ${${GD_PREFIX}YEAR}${${GD_PREFIX}MONTH}${${GD_PREFIX}DAY}") + message(STATUS " monthly : ${${GD_PREFIX}YEAR}${${GD_PREFIX}MONTH}") + message(STATUS " annually : ${${GD_PREFIX}YEAR}") + message(STATUS "") endif() if(${GD_PREFIX}VERBOSE) diff --git a/Tests/CTestTestStopTime/test.cmake.in b/Tests/CTestTestStopTime/test.cmake.in index 6804789..d4e5a25 100644 --- a/Tests/CTestTestStopTime/test.cmake.in +++ b/Tests/CTestTestStopTime/test.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestSubdir/test.cmake.in b/Tests/CTestTestSubdir/test.cmake.in index 526d453..2b4ef4f 100644 --- a/Tests/CTestTestSubdir/test.cmake.in +++ b/Tests/CTestTestSubdir/test.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestTimeout/test.cmake.in b/Tests/CTestTestTimeout/test.cmake.in index 40241ff..d3d0888 100644 --- a/Tests/CTestTestTimeout/test.cmake.in +++ b/Tests/CTestTestTimeout/test.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestUpload/test.cmake.in b/Tests/CTestTestUpload/test.cmake.in index 19abc89..340877f 100644 --- a/Tests/CTestTestUpload/test.cmake.in +++ b/Tests/CTestTestUpload/test.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestZeroTimeout/test.cmake.in b/Tests/CTestTestZeroTimeout/test.cmake.in index 745e5bc..3252754 100644 --- a/Tests/CTestTestZeroTimeout/test.cmake.in +++ b/Tests/CTestTestZeroTimeout/test.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestUpdateCommon.cmake b/Tests/CTestUpdateCommon.cmake index aaf88a8..db4e08d 100644 --- a/Tests/CTestUpdateCommon.cmake +++ b/Tests/CTestUpdateCommon.cmake @@ -37,10 +37,19 @@ function(check_updates build) REGEX "<(${types}|FullName)>" LIMIT_INPUT ${max_update_xml_size} ) + string(REGEX REPLACE "[ \t]*<(${types})>[ \t]*;[ \t]*<FullName>([^<]*)</FullName>" "\\1{\\2}" UPDATE_XML_ENTRIES "${UPDATE_XML_ENTRIES}") + # If specified, remove the given prefix from the files in Update.xml. + # Some VCS systems, like Perforce, return absolute locations + if(DEFINED REPOSITORY_FILE_PREFIX) + string(REPLACE + "${REPOSITORY_FILE_PREFIX}" "" + UPDATE_XML_ENTRIES "${UPDATE_XML_ENTRIES}") + endif() + # Compare expected and actual entries set(EXTRA "${UPDATE_XML_ENTRIES}") list(REMOVE_ITEM EXTRA ${ARGN} ${UPDATE_EXTRA} ${UPDATE_MAYBE}) @@ -216,7 +225,7 @@ function(run_dashboard_script bin_dir) ) # Verify the updates reported by CTest. - list(APPEND UPDATE_MAYBE Updated{subdir}) + list(APPEND UPDATE_MAYBE Updated{subdir} Updated{CTestConfig.cmake}) check_updates(${bin_dir} Updated{foo.txt} Updated{bar.txt} diff --git a/Tests/CTestUpdateP4.cmake.in b/Tests/CTestUpdateP4.cmake.in new file mode 100644 index 0000000..f0420c4 --- /dev/null +++ b/Tests/CTestUpdateP4.cmake.in @@ -0,0 +1,261 @@ +# This script drives creation of a perforce repository and checks +# that CTest can update from it. + +#----------------------------------------------------------------------------- +# Test in a directory next to this script. +get_filename_component(TOP "${CMAKE_CURRENT_LIST_FILE}" PATH) +set(P4_TOP "${TOP}") +set(TOP "${TOP}/@CTestUpdateP4_DIR@") + +# Include code common to all update tests. +set(REPOSITORY_FILE_PREFIX "//ctest/") +include("@CMAKE_CURRENT_SOURCE_DIR@/CTestUpdateCommon.cmake") + +#----------------------------------------------------------------------------- +# Perforce server options +set(P4_HOST localhost) +set(P4_PORT 1888) + +#----------------------------------------------------------------------------- +# Report p4 tools in use and set its defaults +message("Using P4 tools:") +set(P4 "@P4_EXECUTABLE@") +set(P4D "@P4D_EXECUTABLE@") +message(" p4 = ${P4}") +message(" p4d = ${P4D}") + +set(P4_CLIENT -c ctest_p4) +set(P4_OPTIONS -H ${P4_HOST} -p ${P4_PORT}) +set(P4CMD ${P4} ${P4_OPTIONS}) + +#----------------------------------------------------------------------------- +# Start the Perforce server +if(UNIX) + set(P4_ROOT ${P4_TOP}/perforce) + + message("Starting p4d on '${P4_ROOT}' listening on port ${P4_PORT}...") + + # Stop a previous instance of Perforce running + execute_process( + WORKING_DIRECTORY ${TOP} + COMMAND ${P4CMD} admin stop + OUTPUT_QUIET + ERROR_QUIET + ) + + # Make sure we don't have a perforce directory from a previous run + file(REMOVE_RECURSE ${P4_ROOT}) + file(MAKE_DIRECTORY ${P4_ROOT}) + + set(P4_SERVER "nohup '${P4D}' -d -r '${P4_ROOT}'") + set(P4_SERVER "${P4_SERVER} -L '${P4_ROOT}/p4.log'") + set(P4_SERVER "${P4_SERVER} -J '${P4_ROOT}/journal'") + set(P4_SERVER "${P4_SERVER} -p ${P4_PORT} >/dev/null 2>&1 &") + + message("Server command line: ${P4_SERVER}") + + execute_process( + COMMAND sh -c " +${P4_SERVER} +for i in 1 2 3 4 5 6 7 8 9 10; do + echo 'Waiting for server to start...' + sleep 1 + if '${P4}' -H ${P4_HOST} -p ${P4_PORT} help >/dev/null 2>&1; then + echo 'Server started.' + exit + fi +done +echo 'Gave up waiting for server to start.' +" + ) +endif() + +#----------------------------------------------------------------------------- +# Initialize the testing directory. +message("Creating test directory...") +init_testing() + +#----------------------------------------------------------------------------- +# Create the repository. +message("Creating depot...") +file(WRITE ${TOP}/depot.spec "Depot: ctest\n") +file(APPEND ${TOP}/depot.spec "Type: local\n") +file(APPEND ${TOP}/depot.spec "Map: ctest/...\n") +run_child( + WORKING_DIRECTORY ${TOP} + COMMAND ${P4CMD} depot -i + INPUT_FILE ${TOP}/depot.spec +) + +#----------------------------------------------------------------------------- +# Import initial content into the repository. +message("Importing content...") +create_content(user-source) + +message("Creating client spec...") +file(WRITE ${TOP}/client.spec "Client: ctest_p4\n") +file(APPEND ${TOP}/client.spec "Root: ${TOP}/user-source\n") +file(APPEND ${TOP}/client.spec "View: //ctest/... //ctest_p4/...\n") +run_child( + WORKING_DIRECTORY ${TOP}/user-source + COMMAND ${P4CMD} client -i + INPUT_FILE ${TOP}/client.spec +) + +# After creating the depot and the client view, all P4 commands need to +# have the client spec passed to them +list(APPEND P4CMD ${P4_CLIENT}) + +message("Adding files to repository") +file(GLOB_RECURSE files ${TOP}/user-source/*) +foreach(filename ${files}) + run_child( + WORKING_DIRECTORY ${TOP}/user-source + COMMAND ${P4CMD} add ${filename} + ) +endforeach() + +message("Submitting changes to repository") +run_child( + WORKING_DIRECTORY ${TOP}/user-source + COMMAND ${P4CMD} submit -d "CTEST: Initial content" +) +message("Tagging the repository") +file(WRITE ${TOP}/label.spec "Label: r1\n") +file(APPEND ${TOP}/label.spec "View: //ctest/...\n") + +run_child( + WORKING_DIRECTORY ${TOP}/user-source + COMMAND ${P4CMD} label -i + INPUT_FILE ${TOP}/label.spec +) + +run_child( + WORKING_DIRECTORY ${TOP}/user-source + COMMAND ${P4CMD} labelsync -l r1 +) + +#----------------------------------------------------------------------------- +# Make changes in the working tree. +message("Changing content...") +update_content(user-source files_added files_removed dirs_added) +foreach(filename ${files_added}) + message("add: ${filename}") + run_child( + WORKING_DIRECTORY ${TOP}/user-source + COMMAND ${P4CMD} add ${TOP}/user-source/${filename} + ) +endforeach() +foreach(filename ${files_removed}) + run_child( + WORKING_DIRECTORY ${TOP}/user-source + COMMAND ${P4CMD} delete ${TOP}/user-source/${filename} + ) +endforeach() + +#----------------------------------------------------------------------------- +# Commit the changes to the repository. +message("Committing revision 2...") +run_child( + WORKING_DIRECTORY ${TOP}/user-source + COMMAND ${P4CMD} submit -d "CTEST: Changed content" +) + +#----------------------------------------------------------------------------- +# Make changes in the working tree. +message("Changing content again...") +run_child( + WORKING_DIRECTORY ${TOP}/user-source + COMMAND ${P4CMD} edit //ctest/... +) + +change_content(user-source) +run_child( + WORKING_DIRECTORY ${TOP}/user-source + COMMAND ${P4CMD} revert -a //ctest/... +) + +#----------------------------------------------------------------------------- +# Commit the changes to the repository. +message("Committing revision 3...") +run_child( + WORKING_DIRECTORY ${TOP}/user-source + COMMAND ${P4CMD} submit -d "CTEST: Changed content again" +) + +#----------------------------------------------------------------------------- +# Go back to before the changes so we can test updating. +message("Backing up to revision 1...") +run_child( + WORKING_DIRECTORY ${TOP}/user-source + COMMAND ${P4CMD} sync @r1 + ) + +# Create a modified file. +run_child( + WORKING_DIRECTORY ${TOP}/user-source + COMMAND ${P4CMD} sync @r1 + ) + +# We should p4 open any files that modify_content creates +run_child( + WORKING_DIRECTORY ${TOP}/user-source + COMMAND ${P4CMD} open ${TOP}/user-source/CTestConfig.cmake +) +modify_content(user-source) + +#----------------------------------------------------------------------------- +# Test updating the user work directory with the command-line interface. +message("Running CTest Dashboard Command Line...") + +# Create the user build tree. +create_build_tree(user-source user-binary) +file(APPEND ${TOP}/user-binary/CTestConfiguration.ini + "# P4 command configuration +UpdateCommand: ${P4} +P4Client: ctest_p4 +P4Options: -H ${P4_HOST} -p ${P4_PORT} +") + +# Run the dashboard command line interface. +run_dashboard_command_line(user-binary) + +# Revert the modified files +run_child( + WORKING_DIRECTORY ${TOP}/user-source + COMMAND ${P4CMD} revert ${TOP}/user-source/CTestConfig.cmake +) + +#----------------------------------------------------------------------------- +# Test initial checkout and update with a dashboard script. +# Create a new client so we can check out files on a different directory +message("Running CTest Dashboard Script...") + +message("Creating client spec...") +file(WRITE ${TOP}/client2.spec "Client: ctest2_p4\n") +file(APPEND ${TOP}/client2.spec "Root: ${TOP}/dash-source\n") +file(APPEND ${TOP}/client2.spec "View: //ctest/... //ctest2_p4/...\n") +run_child( + COMMAND ${P4CMD} client -i + INPUT_FILE ${TOP}/client2.spec +) + +file(MAKE_DIRECTORY ${TOP}/dash-source) + +create_dashboard_script(dash-binary + "# P4 command configuration +set(CTEST_P4_CLIENT \"ctest2_p4\") +set(CTEST_P4_OPTIONS \"-H ${P4_HOST} -p ${P4_PORT}\") +set(CTEST_UPDATE_COMMAND \"${P4}\") +") + +# Run the dashboard script with CTest. +run_dashboard_script(dash-binary) + +#----------------------------------------------------------------------------- +# Clean up +message("Shutting down p4d") +run_child( + WORKING_DIRECTORY ${TOP} + COMMAND ${P4CMD} admin stop +)
\ No newline at end of file diff --git a/Tests/CompatibleInterface/CMakeLists.txt b/Tests/CompatibleInterface/CMakeLists.txt index ae1d2fa..350b518 100644 --- a/Tests/CompatibleInterface/CMakeLists.txt +++ b/Tests/CompatibleInterface/CMakeLists.txt @@ -6,7 +6,7 @@ project(CompatibleInterface) include(GenerateExportHeader) set(CMAKE_INCLUDE_CURRENT_DIR ON) -add_library(iface1 empty.cpp) +add_library(iface1 INTERFACE) set_property(TARGET iface1 APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL BOOL_PROP1 @@ -20,11 +20,36 @@ set_property(TARGET iface1 APPEND PROPERTY STRING_PROP2 STRING_PROP3 ) +set_property(TARGET iface1 APPEND PROPERTY + COMPATIBLE_INTERFACE_NUMBER_MIN + NUMBER_MIN_PROP1 + NUMBER_MIN_PROP2 + NUMBER_MIN_PROP3 + NUMBER_MIN_PROP4 +) +set_property(TARGET iface1 APPEND PROPERTY + COMPATIBLE_INTERFACE_NUMBER_MAX + NUMBER_MAX_PROP1 + NUMBER_MAX_PROP2 +) + +set(CMAKE_DEBUG_TARGET_PROPERTIES + BOOL_PROP1 BOOL_PROP2 BOOL_PROP3 BOOL_PROP4 + STRING_PROP1 STRING_PROP2 STRING_PROP3 + NUMBER_MIN_PROP1 NUMBER_MIN_PROP2 NUMBER_MIN_PROP3 NUMBER_MIN_PROP4 + NUMBER_MAX_PROP1 NUMBER_MAX_PROP2 +) set_property(TARGET iface1 PROPERTY INTERFACE_BOOL_PROP1 ON) set_property(TARGET iface1 PROPERTY INTERFACE_BOOL_PROP2 ON) set_property(TARGET iface1 PROPERTY INTERFACE_STRING_PROP1 prop1) set_property(TARGET iface1 PROPERTY INTERFACE_STRING_PROP2 prop2) +set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MIN_PROP1 100) +set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MIN_PROP2 200) +set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MIN_PROP3 0x10) +set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MIN_PROP4 0x10) +set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MAX_PROP1 100) +set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MAX_PROP2 200) add_executable(CompatibleInterface main.cpp) target_link_libraries(CompatibleInterface iface1) @@ -33,6 +58,12 @@ set_property(TARGET CompatibleInterface PROPERTY BOOL_PROP2 ON) set_property(TARGET CompatibleInterface PROPERTY BOOL_PROP3 ON) set_property(TARGET CompatibleInterface PROPERTY STRING_PROP2 prop2) set_property(TARGET CompatibleInterface PROPERTY STRING_PROP3 prop3) +set_property(TARGET CompatibleInterface PROPERTY NUMBER_MIN_PROP1 50) +set_property(TARGET CompatibleInterface PROPERTY NUMBER_MIN_PROP2 250) +set_property(TARGET CompatibleInterface PROPERTY NUMBER_MIN_PROP3 0xa) +set_property(TARGET CompatibleInterface PROPERTY NUMBER_MIN_PROP4 0x1A) +set_property(TARGET CompatibleInterface PROPERTY NUMBER_MAX_PROP1 50) +set_property(TARGET CompatibleInterface PROPERTY NUMBER_MAX_PROP2 250) target_compile_definitions(CompatibleInterface PRIVATE @@ -42,6 +73,12 @@ target_compile_definitions(CompatibleInterface $<$<STREQUAL:$<TARGET_PROPERTY:STRING_PROP1>,prop1>:STRING_PROP1> $<$<STREQUAL:$<TARGET_PROPERTY:STRING_PROP2>,prop2>:STRING_PROP2> $<$<STREQUAL:$<TARGET_PROPERTY:STRING_PROP3>,prop3>:STRING_PROP3> + $<$<STREQUAL:$<TARGET_PROPERTY:NUMBER_MIN_PROP1>,50>:NUMBER_MIN_PROP1=50> + $<$<STREQUAL:$<TARGET_PROPERTY:NUMBER_MIN_PROP2>,200>:NUMBER_MIN_PROP2=200> + $<$<EQUAL:$<TARGET_PROPERTY:NUMBER_MIN_PROP3>,0xA>:NUMBER_MIN_PROP3=0xA> + $<$<STREQUAL:$<TARGET_PROPERTY:NUMBER_MIN_PROP4>,0x10>:NUMBER_MIN_PROP4=0x10> + $<$<STREQUAL:$<TARGET_PROPERTY:NUMBER_MAX_PROP1>,100>:NUMBER_MAX_PROP1=100> + $<$<STREQUAL:$<TARGET_PROPERTY:NUMBER_MAX_PROP2>,250>:NUMBER_MAX_PROP2=250> ) diff --git a/Tests/CompatibleInterface/main.cpp b/Tests/CompatibleInterface/main.cpp index f5e6e38..e23625a 100644 --- a/Tests/CompatibleInterface/main.cpp +++ b/Tests/CompatibleInterface/main.cpp @@ -23,6 +23,21 @@ #error Expected STRING_PROP3 #endif +template<bool test> +struct CMakeStaticAssert; + +template<> +struct CMakeStaticAssert<true> {}; + +enum { + NumericMaxTest1 = sizeof(CMakeStaticAssert<NUMBER_MAX_PROP1 == 100>), + NumericMaxTest2 = sizeof(CMakeStaticAssert<NUMBER_MAX_PROP2 == 250>), + NumericMinTest1 = sizeof(CMakeStaticAssert<NUMBER_MIN_PROP1 == 50>), + NumericMinTest2 = sizeof(CMakeStaticAssert<NUMBER_MIN_PROP2 == 200>), + NumericMinTest3 = sizeof(CMakeStaticAssert<NUMBER_MIN_PROP3 == 0xA>), + NumericMinTest4 = sizeof(CMakeStaticAssert<NUMBER_MIN_PROP4 == 0x10>) +}; + #include "iface2.h" int main(int argc, char **argv) diff --git a/Tests/CompileDefinitions/compiletest.c b/Tests/CompileDefinitions/compiletest.c index d7883af..8871750 100644 --- a/Tests/CompileDefinitions/compiletest.c +++ b/Tests/CompileDefinitions/compiletest.c @@ -13,6 +13,10 @@ #error Unexpected LINK_LANGUAGE_IS_CXX #endif +#ifdef DEBUG_MODE +#error Unexpected DEBUG_MODE +#endif + int main(void) { return 0; diff --git a/Tests/CompileDefinitions/target_prop/CMakeLists.txt b/Tests/CompileDefinitions/target_prop/CMakeLists.txt index a0d3f4e..2ca2869 100644 --- a/Tests/CompileDefinitions/target_prop/CMakeLists.txt +++ b/Tests/CompileDefinitions/target_prop/CMakeLists.txt @@ -35,6 +35,9 @@ set_property(TARGET target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS add_executable(target_prop_c_executable ../compiletest.c) +cmake_policy(SET CMP0043 NEW) +set_property(TARGET target_prop_c_executable APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG DEBUG_MODE) + set_property(TARGET target_prop_c_executable APPEND PROPERTY COMPILE_DEFINITIONS "$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:LINK_CXX_DEFINE>" "$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,C>:LINK_C_DEFINE>" diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt index 50dccbe..fcde44d 100644 --- a/Tests/Complex/CMakeLists.txt +++ b/Tests/Complex/CMakeLists.txt @@ -1,7 +1,7 @@ # # A more complex test case # -set(CMAKE_BACKWARDS_COMPATIBILITY 1.4) +cmake_minimum_required(VERSION 2.4) project (Complex) # Try setting a new policy. The IF test is for coverage. @@ -198,14 +198,14 @@ make_directory("${Complex_BINARY_DIR}/make_dir") configure_file( ${Complex_SOURCE_DIR}/Library/dummy ${Complex_BINARY_DIR}/Library/dummylib.lib - COPYONLY IMMEDIATE) + COPYONLY) foreach (ext ${CMAKE_SHLIB_SUFFIX};.so;.a;.sl ${CMAKE_SHARED_LIBRARY_SUFFIX}.2 ${CMAKE_STATIC_LIBRARY_SUFFIX}.2) configure_file( ${Complex_SOURCE_DIR}/Library/dummy ${Complex_BINARY_DIR}/Library/libdummylib${ext} - COPYONLY IMMEDIATE) + COPYONLY) endforeach () find_library(FIND_DUMMY_LIB @@ -281,7 +281,7 @@ if (WIN32) configure_file( ${Complex_SOURCE_DIR}/Library/dummy "${dir}/${file}" - COPYONLY IMMEDIATE) + COPYONLY) exec_program(${CMAKE_COMMAND} ARGS "-E write_regv \"${hkey}\" \"${dir}\"") find_path(REGISTRY_TEST_PATH ${file} diff --git a/Tests/Complex/Executable/CMakeLists.txt b/Tests/Complex/Executable/CMakeLists.txt index 2613f27..bf23d4a 100644 --- a/Tests/Complex/Executable/CMakeLists.txt +++ b/Tests/Complex/Executable/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 1.3) # # Create exe. # diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx index e904f28..31442ba 100644 --- a/Tests/Complex/Executable/complex.cxx +++ b/Tests/Complex/Executable/complex.cxx @@ -838,13 +838,13 @@ int main() #endif #endif // defined(_WIN32) && !defined(__CYGWIN__) - if(strcmp(CMAKE_MINIMUM_REQUIRED_VERSION, "1.3") == 0) + if(strcmp(CMAKE_MINIMUM_REQUIRED_VERSION, "2.4") == 0) { - cmPassed("CMAKE_MINIMUM_REQUIRED_VERSION is set to 1.3"); + cmPassed("CMAKE_MINIMUM_REQUIRED_VERSION is set to 2.4"); } else { - cmFailed("CMAKE_MINIMUM_REQUIRED_VERSION is not set to the expected 1.3"); + cmFailed("CMAKE_MINIMUM_REQUIRED_VERSION is not set to the expected 2.4"); } // ---------------------------------------------------------------------- diff --git a/Tests/Complex/Library/CMakeLists.txt b/Tests/Complex/Library/CMakeLists.txt index 5c43052..f00cbd6 100644 --- a/Tests/Complex/Library/CMakeLists.txt +++ b/Tests/Complex/Library/CMakeLists.txt @@ -51,7 +51,7 @@ define_property( FULL_DOCS "A simple etst proerty that means nothign and is used for nothing" ) set_target_properties(CMakeTestCLibraryShared PROPERTIES FOO BAR) -if(NOT BEOS AND NOT WIN32) # No libm on BeOS. +if(NOT BEOS AND NOT WIN32 AND NOT HAIKU) # No libm on BeOS. set_target_properties(CMakeTestCLibraryShared PROPERTIES LINK_FLAGS "-lm") endif() get_target_property(FOO_BAR_VAR CMakeTestCLibraryShared FOO) diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt index cbb4286..a4a0e0e 100644 --- a/Tests/ComplexOneConfig/CMakeLists.txt +++ b/Tests/ComplexOneConfig/CMakeLists.txt @@ -1,7 +1,7 @@ # # A more complex test case # -set(CMAKE_BACKWARDS_COMPATIBILITY 1.4) +cmake_minimum_required(VERSION 2.4) project (Complex) # Try setting a new policy. The IF test is for coverage. @@ -198,12 +198,12 @@ make_directory("${Complex_BINARY_DIR}/make_dir") configure_file( ${Complex_SOURCE_DIR}/Library/dummy ${Complex_BINARY_DIR}/Library/dummylib.lib - COPYONLY IMMEDIATE) + COPYONLY) foreach (ext ${CMAKE_SHLIB_SUFFIX};.so;.a;.sl) configure_file( ${Complex_SOURCE_DIR}/Library/dummy ${Complex_BINARY_DIR}/Library/libdummylib${ext} - COPYONLY IMMEDIATE) + COPYONLY) endforeach () find_library(FIND_DUMMY_LIB @@ -251,7 +251,7 @@ if (WIN32) configure_file( ${Complex_SOURCE_DIR}/Library/dummy "${dir}/${file}" - COPYONLY IMMEDIATE) + COPYONLY) exec_program(${CMAKE_COMMAND} ARGS "-E write_regv \"${hkey}\" \"${dir}\"") find_path(REGISTRY_TEST_PATH ${file} diff --git a/Tests/ComplexOneConfig/Executable/CMakeLists.txt b/Tests/ComplexOneConfig/Executable/CMakeLists.txt index 432dbf8..01f1005 100644 --- a/Tests/ComplexOneConfig/Executable/CMakeLists.txt +++ b/Tests/ComplexOneConfig/Executable/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 1.3) # # Create exe. # diff --git a/Tests/ComplexOneConfig/Executable/complex.cxx b/Tests/ComplexOneConfig/Executable/complex.cxx index e904f28..31442ba 100644 --- a/Tests/ComplexOneConfig/Executable/complex.cxx +++ b/Tests/ComplexOneConfig/Executable/complex.cxx @@ -838,13 +838,13 @@ int main() #endif #endif // defined(_WIN32) && !defined(__CYGWIN__) - if(strcmp(CMAKE_MINIMUM_REQUIRED_VERSION, "1.3") == 0) + if(strcmp(CMAKE_MINIMUM_REQUIRED_VERSION, "2.4") == 0) { - cmPassed("CMAKE_MINIMUM_REQUIRED_VERSION is set to 1.3"); + cmPassed("CMAKE_MINIMUM_REQUIRED_VERSION is set to 2.4"); } else { - cmFailed("CMAKE_MINIMUM_REQUIRED_VERSION is not set to the expected 1.3"); + cmFailed("CMAKE_MINIMUM_REQUIRED_VERSION is not set to the expected 2.4"); } // ---------------------------------------------------------------------- diff --git a/Tests/ComplexOneConfig/Library/CMakeLists.txt b/Tests/ComplexOneConfig/Library/CMakeLists.txt index 5c43052..f00cbd6 100644 --- a/Tests/ComplexOneConfig/Library/CMakeLists.txt +++ b/Tests/ComplexOneConfig/Library/CMakeLists.txt @@ -51,7 +51,7 @@ define_property( FULL_DOCS "A simple etst proerty that means nothign and is used for nothing" ) set_target_properties(CMakeTestCLibraryShared PROPERTIES FOO BAR) -if(NOT BEOS AND NOT WIN32) # No libm on BeOS. +if(NOT BEOS AND NOT WIN32 AND NOT HAIKU) # No libm on BeOS. set_target_properties(CMakeTestCLibraryShared PROPERTIES LINK_FLAGS "-lm") endif() get_target_property(FOO_BAR_VAR CMakeTestCLibraryShared FOO) diff --git a/Tests/Contracts/Trilinos-10-6/CMakeLists.txt b/Tests/Contracts/Trilinos/CMakeLists.txt index 79ed669..f5757b5 100644 --- a/Tests/Contracts/Trilinos-10-6/CMakeLists.txt +++ b/Tests/Contracts/Trilinos/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 2.8) -project(Trilinos-10-6) +project(Trilinos) include(ExternalProject) @@ -27,12 +27,12 @@ endif() message(STATUS "HOME='${HOME}'") if(NOT DEFINED url) - set(url "http://www.cmake.org/files/contracts/trilinos-10.6.1.tar.gz") + set(url "http://www.cmake.org/files/contracts/trilinos-11.4.1.tar.gz") endif() message(STATUS "url='${url}'") if(NOT DEFINED md5) - set(md5 "690230465dd21a76e3c6636fd07bd2f0") + set(md5 "28b6a3c7c0fb317b3a237997293faa8b") endif() message(STATUS "md5='${md5}'") diff --git a/Tests/Contracts/Trilinos-10-6/Dashboard.cmake.in b/Tests/Contracts/Trilinos/Dashboard.cmake.in index cc29502..93d4f61 100644 --- a/Tests/Contracts/Trilinos-10-6/Dashboard.cmake.in +++ b/Tests/Contracts/Trilinos/Dashboard.cmake.in @@ -14,7 +14,7 @@ set(ENV{CTEST_SITE} "${CTEST_SITE}") # Allow override of the environment on a per-client basis: # -set(ENV_SCRIPT "$ENV{CMAKE_CONTRACT_Trilinos_10_6_ENV_SCRIPT}") +set(ENV_SCRIPT "$ENV{CMAKE_CONTRACT_Trilinos_ENV_SCRIPT}") if(ENV_SCRIPT AND EXISTS "${ENV_SCRIPT}") include("${ENV_SCRIPT}") endif() @@ -49,7 +49,7 @@ endif() # execute_process(COMMAND "${CMAKE_CTEST_COMMAND}" - -S "${CTEST_SOURCE_DIRECTORY}/cmake/ctest/experimental_build_test.cmake" + -S "${CTEST_SOURCE_DIRECTORY}/cmake/tribits/ctest/experimental_build_test.cmake" -VV WORKING_DIRECTORY "${CTEST_BINARY_DIRECTORY}" RESULT_VARIABLE rv diff --git a/Tests/Contracts/Trilinos-10-6/EnvScript.cmake b/Tests/Contracts/Trilinos/EnvScript.cmake index dacb704..dacb704 100644 --- a/Tests/Contracts/Trilinos-10-6/EnvScript.cmake +++ b/Tests/Contracts/Trilinos/EnvScript.cmake diff --git a/Tests/Contracts/Trilinos-10-6/Patch.cmake b/Tests/Contracts/Trilinos/Patch.cmake index 6c619ac..6c619ac 100644 --- a/Tests/Contracts/Trilinos-10-6/Patch.cmake +++ b/Tests/Contracts/Trilinos/Patch.cmake diff --git a/Tests/Contracts/Trilinos-10-6/RunTest.cmake b/Tests/Contracts/Trilinos/RunTest.cmake index 30124d8..d661a4c 100644 --- a/Tests/Contracts/Trilinos-10-6/RunTest.cmake +++ b/Tests/Contracts/Trilinos/RunTest.cmake @@ -4,4 +4,4 @@ set(dir "${CMAKE_CURRENT_BINARY_DIR}/Contracts/${project}") set(exe "${CMAKE_COMMAND}") set(args -P "${dir}/ValidateBuild.cmake") -set(Trilinos-10-6_RUN_TEST ${exe} ${args}) +set(Trilinos_RUN_TEST ${exe} ${args}) diff --git a/Tests/Contracts/Trilinos-10-6/ValidateBuild.cmake.in b/Tests/Contracts/Trilinos/ValidateBuild.cmake.in index 04bbf21..fa38ada 100644 --- a/Tests/Contracts/Trilinos-10-6/ValidateBuild.cmake.in +++ b/Tests/Contracts/Trilinos/ValidateBuild.cmake.in @@ -20,10 +20,10 @@ message(STATUS "Found len='${len}' *.exe files") # Try to find the Teuchos unit tests executable: # -file(GLOB_RECURSE exe "${binary_dir}/Teuchos_UnitTest_UnitTests.exe") +file(GLOB_RECURSE exe "${binary_dir}/TeuchosCore_UnitTest_UnitTests.exe") list(LENGTH exe len) if(NOT len EQUAL 1) - message(FATAL_ERROR "len='${len}' is not the expected='1' (count of Teuchos_UnitTest_UnitTests.exe)") + message(FATAL_ERROR "len='${len}' is not the expected='1' (count of TeuchosCore_UnitTest_UnitTests.exe)") endif() message(STATUS "Found exe='${exe}'") @@ -31,7 +31,7 @@ message(STATUS "Found exe='${exe}'") # Try to run it: execute_process(COMMAND ${exe} RESULT_VARIABLE rv) if(NOT "${rv}" STREQUAL "0") - message(FATAL_ERROR "rv='${rv}' is not the expected='0' (result of running Teuchos_UnitTest_UnitTests.exe)") + message(FATAL_ERROR "rv='${rv}' is not the expected='0' (result of running TeuchosCore_UnitTest_UnitTests.exe)") endif() message(STATUS "Ran exe='${exe}' rv='${rv}'") diff --git a/Tests/Contracts/VTK/CMakeLists.txt b/Tests/Contracts/VTK/CMakeLists.txt new file mode 100644 index 0000000..ef19325 --- /dev/null +++ b/Tests/Contracts/VTK/CMakeLists.txt @@ -0,0 +1,47 @@ +# The VTK external project for CMake +# --------------------------------------------------------------------------- +cmake_minimum_required(VERSION 2.8) +project(VTK) +include(ExternalProject) + +# find "HOME". VTK will be downloaded & built within a subdirectory. +if(NOT DEFINED HOME) + if(DEFINED ENV{CTEST_REAL_HOME}) + set(HOME "$ENV{CTEST_REAL_HOME}") + else() + set(HOME "$ENV{HOME}") + endif() + + if(NOT HOME AND WIN32) + # Try for USERPROFILE as HOME equivalent: + string(REPLACE "\\" "/" HOME "$ENV{USERPROFILE}") + + # But just use root of SystemDrive if USERPROFILE contains any spaces: + # (Default on XP and earlier...) + if(HOME MATCHES " ") + string(REPLACE "\\" "/" HOME "$ENV{SystemDrive}") + endif() + endif() +endif() + +set(base_dir "${HOME}/.cmake/Contracts/VTK") + +if(NOT DEFINED SITE) + site_name(SITE) +endif() + +# configure our dashboard script +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/Dashboard.cmake.in + ${base_dir}/Dashboard.cmake + @ONLY) + +# build & test VTK's release branch +ExternalProject_Add(${PROJECT_NAME} + GIT_REPOSITORY "git://vtk.org/VTK.git" + GIT_TAG "release" + PREFIX ${base_dir} + CONFIGURE_COMMAND "" + BUILD_COMMAND ${CMAKE_CTEST_COMMAND} -S "${base_dir}/Dashboard.cmake" + INSTALL_COMMAND "" +) diff --git a/Tests/Contracts/VTK/Dashboard.cmake.in b/Tests/Contracts/VTK/Dashboard.cmake.in new file mode 100644 index 0000000..c3d10f4 --- /dev/null +++ b/Tests/Contracts/VTK/Dashboard.cmake.in @@ -0,0 +1,37 @@ +# This submission's role is to test leading edge of cmake development +# against VTK release +# +# Maintainer: Zack Galbreath <zack.galbreath@kitware.com> +# +# This file was generated as part of the CMake/VTK Contracts test. +# See <CMake-src>/Tests/Contracts/VTK/ for more information + +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "Contracts.VTK") +set(CTEST_DASHBOARD_ROOT "@base_dir@") +set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/src/VTK") +set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/VTK-build") + +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CONFIGURATION_TYPE Debug) +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") + +# Assume a Linux build, with a make that supports -j9. Modify this script if +# assumption is ever invalid. +# +set(CTEST_BUILD_COMMAND "@CMAKE_MAKE_PROGRAM@ -j9 -i") + +ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY}) + +file(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" " + BUILD_EXAMPLES:BOOL=ON + BUILD_TESTING:BOOL=ON + VTK_WRAP_PYTHON:BOOL=ON + ExternalData_OBJECT_STORES:FILEPATH=@base_dir@/ExternalData +") + +ctest_start(Nightly) +ctest_configure(BUILD "${CTEST_BINARY_DIRECTORY}") +ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}") +ctest_test(BUILD "${CTEST_BINARY_DIRECTORY}" INCLUDE "PythonSmoke") +ctest_submit(BUILD "${CTEST_BINARY_DIRECTORY}") diff --git a/Tests/Contracts/VTK/RunTest.cmake b/Tests/Contracts/VTK/RunTest.cmake new file mode 100644 index 0000000..65285cf --- /dev/null +++ b/Tests/Contracts/VTK/RunTest.cmake @@ -0,0 +1,3 @@ +set(exe "$ENV{HOME}/.cmake/Contracts/VTK/VTK-build/bin/vtkCommonCoreCxxTests") +set(args otherArrays) +set(VTK_RUN_TEST ${exe} ${args}) diff --git a/Tests/Contracts/vtk542/CMakeLists.txt b/Tests/Contracts/vtk542/CMakeLists.txt deleted file mode 100644 index cfb8b16..0000000 --- a/Tests/Contracts/vtk542/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -# The VTK external project for CMake -# --------------------------------------------------------------------------- -cmake_minimum_required(VERSION 2.8) -project(vtk542) -include(ExternalProject) - - -set(vtk_source "${CMAKE_CURRENT_BINARY_DIR}/VTK-source") -set(vtk_binary "${CMAKE_CURRENT_BINARY_DIR}/VTK-build") - -ExternalProject_Add(VTK - DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR} - URL "http://www.vtk.org/files/release/5.4/vtk-5.4.2.tar.gz" - URL_MD5 c2c797091d4b2128d9a1bd32c4b78227 - SOURCE_DIR ${vtk_source} - BINARY_DIR ${vtk_binary} - CMAKE_GENERATOR "${CMAKE_GENERATOR}" - CMAKE_ARGS - -DBUILD_EXAMPLES:BOOL=ON - -DBUILD_TESTING:BOOL=ON - INSTALL_COMMAND "" - ) -# make it so that each build will run make in the VTK build tree -ExternalProject_Add_Step(VTK forcebuild - COMMAND ${CMAKE_COMMAND} - -E remove ${CMAKE_CURRENT_BUILD_DIR}/VTK-prefix/src/VTK-stamp/VTK-build - DEPENDEES configure - DEPENDERS build - ALWAYS 1 - ) diff --git a/Tests/Contracts/vtk542/RunTest.cmake b/Tests/Contracts/vtk542/RunTest.cmake deleted file mode 100644 index b4bd5b0..0000000 --- a/Tests/Contracts/vtk542/RunTest.cmake +++ /dev/null @@ -1 +0,0 @@ -set(vtk542_RUN_TEST VTK-build/bin/CommonCxxTests otherArrays) diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt index 30daa7d..bbae387 100644 --- a/Tests/CustomCommand/CMakeLists.txt +++ b/Tests/CustomCommand/CMakeLists.txt @@ -29,9 +29,6 @@ set (EXECUTABLE_OUTPUT_PATH # add the executable that will generate the file add_executable(generator generator.cxx) -get_target_property(generator_PATH generator LOCATION) -message("Location ${generator_PATH}") - ################################################################ # # Test using a wrapper to wrap a header file @@ -170,7 +167,7 @@ add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/not_included.h configure_file( ${PROJECT_SOURCE_DIR}/config.h.in ${PROJECT_BINARY_DIR}/config.h - @ONLY IMMEDIATE + @ONLY ) # add the executable @@ -189,7 +186,7 @@ add_executable(CustomCommand # generated source in a target. add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/generated.c DEPENDS generator - COMMAND ${generator_PATH} + COMMAND generator ARGS ${PROJECT_BINARY_DIR}/generated.c ) @@ -375,7 +372,7 @@ foreach(arg ${CHECK_ARGS} "") endforeach() configure_file(${CMAKE_CURRENT_SOURCE_DIR}/check_command_line.c.in ${CMAKE_CURRENT_BINARY_DIR}/check_command_line.c - @ONLY IMMEDIATE) + @ONLY) add_executable(check_command_line ${CMAKE_CURRENT_BINARY_DIR}/check_command_line.c) set(output_name "check_command_line") @@ -449,3 +446,10 @@ set_property(SOURCE perconfig.out PROPERTY SYMBOLIC 1) add_custom_target(perconfig_target ALL COMMAND ${CMAKE_COMMAND} -E echo "perconfig=$<TARGET_FILE:perconfig>" "config=$<CONFIGURATION>" DEPENDS perconfig.out) + +# Test SOURCES in add_custom_target() with COMPILE_DEFINITIONS +# which previously caused a crash in the makefile generators. +add_custom_target(source_in_custom_target SOURCES source_in_custom_target.cpp) +set_property(SOURCE source_in_custom_target + PROPERTY COMPILE_DEFINITIONS "TEST" +) diff --git a/Tests/CustomCommand/source_in_custom_target.cpp b/Tests/CustomCommand/source_in_custom_target.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/CustomCommand/source_in_custom_target.cpp diff --git a/Tests/DocTest/CMakeLists.txt b/Tests/DocTest/CMakeLists.txt deleted file mode 100644 index 837328e..0000000 --- a/Tests/DocTest/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required (VERSION 2.6) -project (DocTest) - -add_executable (DocTest DocTest.cxx) - -set_property(GLOBAL PROPERTY REPORT_UNDEFINED_PROPERTIES - "${CMAKE_CURRENT_BINARY_DIR}/UndefinedProperties.txt") diff --git a/Tests/DocTest/DocTest.cxx b/Tests/DocTest/DocTest.cxx deleted file mode 100644 index a8a62ab..0000000 --- a/Tests/DocTest/DocTest.cxx +++ /dev/null @@ -1,33 +0,0 @@ -#include <fstream> -#include <iostream> -#include <stdio.h> - -int main () -{ - int result = 0; - - // parse the dart test file - std::ifstream fin("UndefinedProperties.txt"); - if(!fin) - { - fprintf(stderr,"failed to find undefined properties file"); - return 1; - } - - char buffer[1024]; - while ( fin ) - { - buffer[0] = 0; - fin.getline(buffer, 1023); - buffer[1023] = 0; - std::string line = buffer; - if(line.size() && line.find("with scope VARIABLE") == std::string::npos) - { - fprintf(stderr, "%s\n", line.c_str()); - result = 1; - } - } - fin.close(); - - return result; -} diff --git a/Tests/ExportImport/CMakeLists.txt b/Tests/ExportImport/CMakeLists.txt index b8368fc..02a0371 100644 --- a/Tests/ExportImport/CMakeLists.txt +++ b/Tests/ExportImport/CMakeLists.txt @@ -1,5 +1,8 @@ cmake_minimum_required (VERSION 2.7.20090711) project(ExportImport C CXX) +if(NOT DEFINED CMAKE_TEST_MAKEPROGRAM AND NOT CMAKE_GENERATOR MATCHES "Visual Studio") + set(CMAKE_TEST_MAKEPROGRAM "${CMAKE_MAKE_PROGRAM}") +endif() # Wipe out the install tree to make sure the exporter works. add_custom_command( @@ -42,7 +45,6 @@ add_custom_command( --build-target install --build-generator ${CMAKE_GENERATOR} --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" - --build-makeprogram ${CMAKE_MAKE_PROGRAM} --build-options -C${ExportImport_BINARY_DIR}/InitialCache.cmake VERBATIM ) @@ -64,7 +66,6 @@ add_custom_command( --build-project Import --build-generator ${CMAKE_GENERATOR} --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" - --build-makeprogram ${CMAKE_MAKE_PROGRAM} --build-options -C${ExportImport_BINARY_DIR}/InitialCache.cmake VERBATIM ) diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index 72ae78f..0e2828e 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -298,12 +298,38 @@ set_property(TARGET cmp0022OLD APPEND PROPERTY LINK_INTERFACE_LIBRARIES testLib3 add_library(noIncludesInterface empty.cpp) +add_library(systemlib SHARED systemlib.cpp) +install(FILES systemlib.h DESTINATION include/systemlib) +target_include_directories(systemlib + INTERFACE + $<INSTALL_INTERFACE:include/systemlib> + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> +) + install(TARGETS testLibRequired EXPORT RequiredExp DESTINATION lib INCLUDES DESTINATION installIncludesTest $<INSTALL_PREFIX>/installIncludesTest2 - ) + installIncludesTest3/$<TARGET_PROPERTY:NAME> + $<TARGET_PROPERTY:NAME>/installIncludesTest4 + $<INSTALL_INTERFACE:installIncludesTest5$<0:>> + $<INSTALL_INTERFACE:$<0:>installIncludesTest6> + $<INSTALL_INTERFACE:$<INSTALL_PREFIX>/installIncludesTest7> +) + +target_include_directories(testLibRequired INTERFACE + # These can't be in the above install(INCLUDES DESTINATION call because + # that is only for installed interfaces. These directories are prefixes + # in the build dir, which is an error for the installed interface. + # We add them here so that we don't have to add conditions in the Import + # component of the test. + $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest5$<0:>> + $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/$<0:>installIncludesTest6> + $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest7> + $<INSTALL_INTERFACE:installIncludesTest8/$<0:>> + $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest8$<0:>> +) install(TARGETS testLibIncludeRequired1 testLibIncludeRequired2 @@ -326,6 +352,18 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest/installIncludesTest. file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest2") file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest2/installIncludesTest2.h" "// No content\n") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest3/testLibRequired") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest3/testLibRequired/installIncludesTest3.h" "// No content\n") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/testLibRequired/installIncludesTest4") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/testLibRequired/installIncludesTest4/installIncludesTest4.h" "// No content\n") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest5") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest5/installIncludesTest5.h" "// No content\n") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest6") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest6/installIncludesTest6.h" "// No content\n") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest7") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest7/installIncludesTest7.h" "// No content\n") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest8") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest8/installIncludesTest8.h" "// No content\n") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest/installIncludesTest.h" DESTINATION installIncludesTest @@ -334,6 +372,30 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest2/installIncludesTest2.h" DESTINATION installIncludesTest2 ) +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest3/testLibRequired/installIncludesTest3.h" + DESTINATION installIncludesTest3/testLibRequired +) +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/testLibRequired/installIncludesTest4/installIncludesTest4.h" + DESTINATION testLibRequired/installIncludesTest4 +) +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest5/installIncludesTest5.h" + DESTINATION installIncludesTest5 +) +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest6/installIncludesTest6.h" + DESTINATION installIncludesTest6 +) +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest7/installIncludesTest7.h" + DESTINATION installIncludesTest7 +) +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest8/installIncludesTest8.h" + DESTINATION installIncludesTest8 +) install(TARGETS testLibDepends testSharedLibDepends EXPORT DependsExp DESTINATION lib ) install(EXPORT DependsExp FILE testLibDependsTargets.cmake DESTINATION lib/cmake/testLibDepends) @@ -366,6 +428,7 @@ install( testLib6 testLibCycleA testLibCycleB cmp0022NEW cmp0022OLD + systemlib EXPORT exp RUNTIME DESTINATION bin LIBRARY DESTINATION lib NAMELINK_SKIP @@ -417,6 +480,7 @@ export(TARGETS testExe1 testLib1 testLib2 testLib3 testSharedLibRequired testSharedLibRequiredUser testSharedLibRequiredUser2 testSharedLibDepends renamed_on_export cmp0022NEW cmp0022OLD + systemlib NAMESPACE bld_ FILE ExportBuildTree.cmake ) @@ -426,3 +490,5 @@ export(TARGETS testExe2 testLib4 testLib5 testLib6 testExe3 testExe2lib NAMESPACE bld_ APPEND FILE ExportBuildTree.cmake ) + +add_subdirectory(Interface) diff --git a/Tests/ExportImport/Export/Interface/CMakeLists.txt b/Tests/ExportImport/Export/Interface/CMakeLists.txt new file mode 100644 index 0000000..9d4793d --- /dev/null +++ b/Tests/ExportImport/Export/Interface/CMakeLists.txt @@ -0,0 +1,52 @@ + +add_library(headeronly INTERFACE) +set_property(TARGET headeronly PROPERTY INTERFACE_INCLUDE_DIRECTORIES + "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/headeronly>" + "$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include/headeronly>" +) +set_property(TARGET headeronly PROPERTY INTERFACE_COMPILE_DEFINITIONS "HEADERONLY_DEFINE") + +include(GenerateExportHeader) +add_library(sharedlib SHARED sharedlib.cpp) +generate_export_header(sharedlib) +set_property(TARGET sharedlib PROPERTY INCLUDE_DIRECTORIES + "${CMAKE_CURRENT_SOURCE_DIR}/sharedlib" + "${CMAKE_CURRENT_BINARY_DIR}" +) +set_property(TARGET sharedlib PROPERTY INTERFACE_INCLUDE_DIRECTORIES + "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/sharedlib;${CMAKE_CURRENT_BINARY_DIR}>" + "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/sharedlib>" +) + +set_property(TARGET sharedlib PROPERTY INTERFACE_COMPILE_DEFINITIONS "SHAREDLIB_DEFINE") + +add_library(sharediface INTERFACE) +target_link_libraries(sharediface INTERFACE sharedlib) + +install(TARGETS headeronly sharediface + EXPORT expInterface +) +install(TARGETS sharedlib + EXPORT expInterface + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib NAMELINK_SKIP + ARCHIVE DESTINATION lib + FRAMEWORK DESTINATION Frameworks + BUNDLE DESTINATION Applications +) +install(FILES + headeronly/headeronly.h + DESTINATION include/headeronly +) +install(FILES + sharedlib/sharedlib.h + "${CMAKE_CURRENT_BINARY_DIR}/sharedlib_export.h" + DESTINATION include/sharedlib +) + +install(EXPORT expInterface NAMESPACE exp:: DESTINATION lib/exp) + +export(EXPORT expInterface + NAMESPACE bld:: + FILE ../ExportInterfaceBuildTree.cmake +) diff --git a/Tests/ExportImport/Export/Interface/headeronly/headeronly.h b/Tests/ExportImport/Export/Interface/headeronly/headeronly.h new file mode 100644 index 0000000..3673c21 --- /dev/null +++ b/Tests/ExportImport/Export/Interface/headeronly/headeronly.h @@ -0,0 +1,7 @@ + +enum { one }; + +struct HeaderOnly +{ + int foo() const { return 0; } +}; diff --git a/Tests/ExportImport/Export/Interface/sharedlib.cpp b/Tests/ExportImport/Export/Interface/sharedlib.cpp new file mode 100644 index 0000000..88ca713 --- /dev/null +++ b/Tests/ExportImport/Export/Interface/sharedlib.cpp @@ -0,0 +1,7 @@ + +#include "sharedlib.h" + +int SharedLibObject::foo() const +{ + return 0; +} diff --git a/Tests/ExportImport/Export/Interface/sharedlib/sharedlib.h b/Tests/ExportImport/Export/Interface/sharedlib/sharedlib.h new file mode 100644 index 0000000..aad9ef3 --- /dev/null +++ b/Tests/ExportImport/Export/Interface/sharedlib/sharedlib.h @@ -0,0 +1,7 @@ + +#include "sharedlib_export.h" + +struct SHAREDLIB_EXPORT SharedLibObject +{ + int foo() const; +}; diff --git a/Tests/ExportImport/Export/systemlib.cpp b/Tests/ExportImport/Export/systemlib.cpp new file mode 100644 index 0000000..ec45148 --- /dev/null +++ b/Tests/ExportImport/Export/systemlib.cpp @@ -0,0 +1,7 @@ + +#include "systemlib.h" + +SystemStruct::SystemStruct() +{ + +} diff --git a/Tests/ExportImport/Export/systemlib.h b/Tests/ExportImport/Export/systemlib.h new file mode 100644 index 0000000..f7900c0 --- /dev/null +++ b/Tests/ExportImport/Export/systemlib.h @@ -0,0 +1,22 @@ + +#ifndef SYSTEMLIB_H +#define SYSTEMLIB_H + +#if defined(_WIN32) || defined(__CYGWIN__) +# define systemlib_EXPORT __declspec(dllexport) +#else +# define systemlib_EXPORT +#endif + +struct systemlib_EXPORT SystemStruct +{ + SystemStruct(); + + void someMethod() + { + int unused; + // unused warning not issued when this header is used as a system header. + } +}; + +#endif diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt index 2627354..ebe4af2 100644 --- a/Tests/ExportImport/Import/A/CMakeLists.txt +++ b/Tests/ExportImport/Import/A/CMakeLists.txt @@ -265,3 +265,50 @@ foreach(_config ${_configs}) ) endforeach() unset(_configs) + +if (((CMAKE_C_COMPILER_ID STREQUAL GNU AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.4) + OR CMAKE_C_COMPILER_ID STREQUAL Clang) + AND (CMAKE_GENERATOR STREQUAL "Unix Makefiles" OR CMAKE_GENERATOR STREQUAL "Ninja")) + include(CheckCXXCompilerFlag) + check_cxx_compiler_flag(-Wunused-variable run_sys_includes_test) + if(run_sys_includes_test) + # The Bullseye wrapper appears to break the -isystem effect. + execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version OUTPUT_VARIABLE out ERROR_VARIABLE out) + if("x${out}" MATCHES "Bullseye") + set(run_sys_includes_test 0) + endif() + endif() + if (run_sys_includes_test) + add_executable(test_system_exp test_system.cpp) + target_link_libraries(test_system_exp exp_systemlib) + target_compile_options(test_system_exp PRIVATE -Wunused-variable -Werror=unused-variable) + + unset(EXP_ERROR_VARIABLE CACHE) + try_compile(EXP_ERROR_VARIABLE + "${CMAKE_CURRENT_SOURCE_DIR}/test_system" + "${CMAKE_CURRENT_SOURCE_DIR}/test_system.cpp" + COMPILE_DEFINITIONS "-Wunused-variable -Werror=unused-variable" + LINK_LIBRARIES exp_systemlib + OUTPUT_VARIABLE OUTPUT + ) + if(NOT EXP_ERROR_VARIABLE) + message(SEND_ERROR "EXP_ERROR_VARIABLE try_compile failed, but it was expected to succeed ${OUTPUT}.") + endif() + + add_executable(test_system_bld test_system.cpp) + target_link_libraries(test_system_bld bld_systemlib) + target_compile_options(test_system_bld PRIVATE -Wunused-variable -Werror=unused-variable) + + unset(BLD_ERROR_VARIABLE CACHE) + try_compile(BLD_ERROR_VARIABLE + "${CMAKE_CURRENT_SOURCE_DIR}/test_system" + "${CMAKE_CURRENT_SOURCE_DIR}/test_system.cpp" + COMPILE_DEFINITIONS "-Wunused-variable -Werror=unused-variable" + LINK_LIBRARIES bld_systemlib + OUTPUT_VARIABLE OUTPUT + ) + if(NOT BLD_ERROR_VARIABLE) + message(SEND_ERROR "BLD_ERROR_VARIABLE try_compile failed, but it was expected to succeed.") + endif() + endif() +endif() diff --git a/Tests/ExportImport/Import/A/deps_iface.c b/Tests/ExportImport/Import/A/deps_iface.c index 48a4c44..953d0ad 100644 --- a/Tests/ExportImport/Import/A/deps_iface.c +++ b/Tests/ExportImport/Import/A/deps_iface.c @@ -6,6 +6,12 @@ #include "installIncludesTest.h" #include "installIncludesTest2.h" +#include "installIncludesTest3.h" +#include "installIncludesTest4.h" +#include "installIncludesTest5.h" +#include "installIncludesTest6.h" +#include "installIncludesTest7.h" +#include "installIncludesTest8.h" #ifndef testLibRequired_IFACE_DEFINE #error Expected testLibRequired_IFACE_DEFINE diff --git a/Tests/ExportImport/Import/A/test_system.cpp b/Tests/ExportImport/Import/A/test_system.cpp new file mode 100644 index 0000000..aae3583 --- /dev/null +++ b/Tests/ExportImport/Import/A/test_system.cpp @@ -0,0 +1,9 @@ + +#include "systemlib.h" + +int main() +{ + SystemStruct s; + (void)s; + return 0; +} diff --git a/Tests/ExportImport/Import/CMakeLists.txt b/Tests/ExportImport/Import/CMakeLists.txt index 9c2d597..5e809a2 100644 --- a/Tests/ExportImport/Import/CMakeLists.txt +++ b/Tests/ExportImport/Import/CMakeLists.txt @@ -19,3 +19,6 @@ add_executable(imp_testTransExe1b imp_testTransExe1.c) target_link_libraries(imp_testTransExe1b imp_lib1b) add_subdirectory(try_compile) + +# Test package INTERFACE controls +add_subdirectory(Interface) diff --git a/Tests/ExportImport/Import/Interface/CMakeLists.txt b/Tests/ExportImport/Import/Interface/CMakeLists.txt new file mode 100644 index 0000000..cf7e2bc --- /dev/null +++ b/Tests/ExportImport/Import/Interface/CMakeLists.txt @@ -0,0 +1,55 @@ + +# Import targets from the exported build tree. +include(${Import_BINARY_DIR}/../Export/ExportInterfaceBuildTree.cmake) + +# Import targets from the exported install tree. +include(${CMAKE_INSTALL_PREFIX}/lib/exp/expInterface.cmake) + +add_library(define_iface INTERFACE) +set_property(TARGET define_iface PROPERTY + INTERFACE_COMPILE_DEFINITIONS DEFINE_IFACE_DEFINE) + +add_executable(headeronlytest_bld headeronlytest.cpp) +target_link_libraries(headeronlytest_bld bld::headeronly) + +set_property(TARGET bld::sharediface APPEND PROPERTY INTERFACE_LINK_LIBRARIES define_iface) + +add_executable(interfacetest_bld interfacetest.cpp) +target_link_libraries(interfacetest_bld bld::sharediface) + +include(CheckCXXSourceCompiles) + +macro(do_try_compile prefix) + + set(CMAKE_REQUIRED_LIBRARIES ${prefix}::headeronly) + check_cxx_source_compiles( + " + #include \"headeronly.h\" + + #ifndef HEADERONLY_DEFINE + #error Expected HEADERONLY_DEFINE + #endif + + int main(int,char**) + { + HeaderOnly ho; + return ho.foo(); + } + " ${prefix}IFACE_TRY_COMPILE) + + if(NOT ${prefix}IFACE_TRY_COMPILE) + message(SEND_ERROR "${prefix} try_compile with IMPORTED INTERFACE target failed!\n\n${OUTPUT}") + endif() +endmacro() + +do_try_compile(bld) + +add_executable(headeronlytest_exp headeronlytest.cpp) +target_link_libraries(headeronlytest_exp exp::headeronly) + +set_property(TARGET exp::sharediface APPEND PROPERTY INTERFACE_LINK_LIBRARIES define_iface) + +add_executable(interfacetest_exp interfacetest.cpp) +target_link_libraries(interfacetest_exp exp::sharediface) + +do_try_compile(exp) diff --git a/Tests/ExportImport/Import/Interface/headeronlytest.cpp b/Tests/ExportImport/Import/Interface/headeronlytest.cpp new file mode 100644 index 0000000..20674a7 --- /dev/null +++ b/Tests/ExportImport/Import/Interface/headeronlytest.cpp @@ -0,0 +1,17 @@ + +#include "headeronly.h" + +#ifndef HEADERONLY_DEFINE +#error Expected HEADERONLY_DEFINE +#endif + +#ifdef SHAREDLIB_DEFINE +#error Unexpected SHAREDLIB_DEFINE +#endif + + +int main(int,char**) +{ + HeaderOnly ho; + return ho.foo(); +} diff --git a/Tests/ExportImport/Import/Interface/interfacetest.cpp b/Tests/ExportImport/Import/Interface/interfacetest.cpp new file mode 100644 index 0000000..786458d --- /dev/null +++ b/Tests/ExportImport/Import/Interface/interfacetest.cpp @@ -0,0 +1,20 @@ + +#include "sharedlib.h" + +#ifndef SHAREDLIB_DEFINE +#error Expected SHAREDLIB_DEFINE +#endif + +#ifdef HEADERONLY_DEFINE +#error Unexpected HEADERONLY_DEFINE +#endif + +#ifndef DEFINE_IFACE_DEFINE +#error Expected DEFINE_IFACE_DEFINE +#endif + +int main(int,char**) +{ + SharedLibObject slo; + return slo.foo(); +} diff --git a/Tests/ExportImport/InitialCache.cmake.in b/Tests/ExportImport/InitialCache.cmake.in index 98d355f..fba6ee2 100644 --- a/Tests/ExportImport/InitialCache.cmake.in +++ b/Tests/ExportImport/InitialCache.cmake.in @@ -1,3 +1,4 @@ +set(CMAKE_MAKE_PROGRAM "@CMAKE_TEST_MAKEPROGRAM@" CACHE FILEPATH "Make Program") set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@" CACHE STRING "C Compiler") set(CMAKE_C_FLAGS "@CMAKE_C_FLAGS@" CACHE STRING "C Flags") set(CMAKE_C_FLAGS_DEBUG "@CMAKE_C_FLAGS_DEBUG@" CACHE STRING "C Flags") diff --git a/Tests/FindGTK2/CMakeLists.txt b/Tests/FindGTK2/CMakeLists.txt new file mode 100644 index 0000000..1c5987c --- /dev/null +++ b/Tests/FindGTK2/CMakeLists.txt @@ -0,0 +1,317 @@ +find_package(GTK2 COMPONENTS gtk glade gtkmm glademm QUIET) + + +# Test GTK2 components +if(GTK2_GTK_FOUND) + add_test(GTK2Components.gtk ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/gtk" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Components/gtk" + ${build_generator_args} + --build-target gtk-all-libs + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Components/gtk" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(GTK2_GTKMM_FOUND) + add_test(GTK2Components.gtkmm ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/gtkmm" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Components/gtkmm" + ${build_generator_args} + --build-target gtkmm-all-libs + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Components/gtkmm" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + + +# Test GTK2 targets +if(TARGET GTK2::glib) + add_test(GTK2Targets.glib ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/glib" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/glib" + ${build_generator_args} + --build-project glib + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/glib" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::gobject) + add_test(GTK2Targets.gobject ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/gobject" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gobject" + ${build_generator_args} + --build-project gobject + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gobject" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::gio) + add_test(GTK2Targets.gio ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/gio" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gio" + ${build_generator_args} + --build-project gio + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gio" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::gmodule) + add_test(GTK2Targets.gmodule ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/gmodule" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gmodule" + ${build_generator_args} + --build-project gmodule + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gmodule" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::gthread) + add_test(GTK2Targets.gthread ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/gthread" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gthread" + ${build_generator_args} + --build-project gthread + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gthread" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::atk) + add_test(GTK2Targets.atk ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/atk" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/atk" + ${build_generator_args} + --build-project atk + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/atk" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::gdk_pixbuf) + add_test(GTK2Targets.gdk_pixbuf ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/gdk_pixbuf" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gdk_pixbuf" + ${build_generator_args} + --build-project gdk_pixbuf + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gdk_pixbuf" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::cairo) + add_test(GTK2Targets.cairo ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/cairo" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/cairo" + ${build_generator_args} + --build-project cairo + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/cairo" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::pango) + add_test(GTK2Targets.pango ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/pango" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/pango" + ${build_generator_args} + --build-project pango + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/pango" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::pangocairo) + add_test(GTK2Targets.pangocairo ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/pangocairo" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/pangocairo" + ${build_generator_args} + --build-project pangocairo + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/pangocairo" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::pangoxft) + add_test(GTK2Targets.pangoxft ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/pangoxft" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/pangoxft" + ${build_generator_args} + --build-project pangoxft + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/pangoxft" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::pangoft2) + add_test(GTK2Targets.pangoft2 ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/pangoft2" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/pangoft2" + ${build_generator_args} + --build-project pangoft2 + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/pangoft2" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::gdk) + add_test(GTK2Targets.gdk ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/gdk" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gdk" + ${build_generator_args} + --build-project gdk + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gdk" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::gtk) + add_test(GTK2Targets.gtk ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/gtk" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gtk" + ${build_generator_args} + --build-project gtk + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gtk" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::sigc++) + add_test(GTK2Targets.sigc++ ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/sigc++" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/sigc++" + ${build_generator_args} + --build-project sigc++ + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/sigc++" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::glibmm) + add_test(GTK2Targets.glibmm ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/glibmm" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/glibmm" + ${build_generator_args} + --build-project glibmm + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/glibmm" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::giomm) + add_test(GTK2Targets.giomm ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/giomm" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/giomm" + ${build_generator_args} + --build-project giomm + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/giomm" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::atkmm) + add_test(GTK2Targets.atkmm ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/atkmm" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/atkmm" + ${build_generator_args} + --build-project atkmm + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/atkmm" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::cairomm) + add_test(GTK2Targets.cairomm ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/cairomm" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/cairomm" + ${build_generator_args} + --build-project cairomm + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/cairomm" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::pangomm) + add_test(GTK2Targets.pangomm ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/pangomm" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/pangomm" + ${build_generator_args} + --build-project pangomm + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/pangomm" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::gdkmm) + add_test(GTK2Targets.gdkmm ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/gdkmm" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/GTK2Targets/gdkmm" + ${build_generator_args} + --build-project gdkmm + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/GTK2Targets/gdkmm" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::gtkmm) + add_test(GTK2Targets.gtkmm ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/gtkmm" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gtkmm" + ${build_generator_args} + --build-target gtkmm-target + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gtkmm" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() diff --git a/Tests/FindGTK2/atk/CMakeLists.txt b/Tests/FindGTK2/atk/CMakeLists.txt new file mode 100644 index 0000000..be37957 --- /dev/null +++ b/Tests/FindGTK2/atk/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(atk C) + +find_package(GTK2 COMPONENTS gtk REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(atk WIN32 main.c) +target_link_libraries(atk GTK2::atk) diff --git a/Tests/FindGTK2/atk/main.c b/Tests/FindGTK2/atk/main.c new file mode 100644 index 0000000..e25030e --- /dev/null +++ b/Tests/FindGTK2/atk/main.c @@ -0,0 +1,7 @@ +#include <atk/atk.h> + +int main(int argc, char *argv[]) +{ + const gchar *name = atk_get_toolkit_name(); + return 0; +} diff --git a/Tests/FindGTK2/atkmm/CMakeLists.txt b/Tests/FindGTK2/atkmm/CMakeLists.txt new file mode 100644 index 0000000..e8320b5 --- /dev/null +++ b/Tests/FindGTK2/atkmm/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(atkmm CXX) + +find_package(GTK2 COMPONENTS gtk gtkmm REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(atkmm WIN32 main.cpp) +target_link_libraries(atkmm GTK2::atkmm) diff --git a/Tests/FindGTK2/atkmm/main.cpp b/Tests/FindGTK2/atkmm/main.cpp new file mode 100644 index 0000000..f455c7a --- /dev/null +++ b/Tests/FindGTK2/atkmm/main.cpp @@ -0,0 +1,8 @@ +#include <atkmm.h> +#include <atkmm/init.h> + +int main(int argc, char *argv[]) +{ + Atk::init(); + return 0; +} diff --git a/Tests/FindGTK2/cairo/CMakeLists.txt b/Tests/FindGTK2/cairo/CMakeLists.txt new file mode 100644 index 0000000..97a7369 --- /dev/null +++ b/Tests/FindGTK2/cairo/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(cairo C) + +find_package(GTK2 COMPONENTS gtk REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(cairo WIN32 main.c) +target_link_libraries(cairo GTK2::cairo) diff --git a/Tests/FindGTK2/cairo/main.c b/Tests/FindGTK2/cairo/main.c new file mode 100644 index 0000000..1b61001 --- /dev/null +++ b/Tests/FindGTK2/cairo/main.c @@ -0,0 +1,52 @@ +/* Taken from http://cairographics.org/samples/ */ + + +#include <cairo.h> +#include <math.h> +#include <stdio.h> + +int main(int argc, char *argv[]) +{ + char *filename; + if (argc != 2) + { + fprintf (stderr, "Usage: %s OUTPUT_FILENAME\n", argv[0]); + return 1; + } + filename = argv[1]; + double xc = 128.0; + double yc = 128.0; + double radius = 100.0; + double angle1 = 45.0 * (M_PI/180.0); /* angles are specified */ + double angle2 = 180.0 * (M_PI/180.0); /* in radians */ + + cairo_surface_t *im = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, xc * 2, yc * 2); + cairo_t *cr = cairo_create(im); + + + cairo_set_line_width (cr, 10.0); + cairo_arc (cr, xc, yc, radius, angle1, angle2); + cairo_stroke (cr); + + /* draw helping lines */ + cairo_set_source_rgba (cr, 1, 0.2, 0.2, 0.6); + cairo_set_line_width (cr, 6.0); + + cairo_arc (cr, xc, yc, 10.0, 0, 2*M_PI); + cairo_fill (cr); + + cairo_arc (cr, xc, yc, radius, angle1, angle1); + cairo_line_to (cr, xc, yc); + cairo_arc (cr, xc, yc, radius, angle2, angle2); + cairo_line_to (cr, xc, yc); + cairo_stroke (cr); + + cairo_status_t status = cairo_surface_write_to_png (im, filename); + cairo_surface_destroy (im); + if (status != CAIRO_STATUS_SUCCESS) { + fprintf(stderr, "Could not save png to '%s'\n", filename); + } + + cairo_destroy(cr); + return 0; +} diff --git a/Tests/FindGTK2/cairomm/CMakeLists.txt b/Tests/FindGTK2/cairomm/CMakeLists.txt new file mode 100644 index 0000000..47a156e --- /dev/null +++ b/Tests/FindGTK2/cairomm/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(cairomm CXX) + +find_package(GTK2 COMPONENTS gtk gtkmm REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(cairomm WIN32 main.cpp) +target_link_libraries(cairomm GTK2::cairomm) diff --git a/Tests/FindGTK2/cairomm/main.cpp b/Tests/FindGTK2/cairomm/main.cpp new file mode 100644 index 0000000..ea8f106 --- /dev/null +++ b/Tests/FindGTK2/cairomm/main.cpp @@ -0,0 +1,62 @@ +// Taken from http://cgit.freedesktop.org/cairomm/plain/examples/surfaces/image-surface.cc + + +/* M_PI is defined in math.h in the case of Microsoft Visual C++, Solaris, + * et. al. + */ +#if defined(_MSC_VER) +#define _USE_MATH_DEFINES +#endif + +#include <string> +#include <iostream> +#include <cairommconfig.h> +#include <cairomm/context.h> +#include <cairomm/surface.h> + +#include <cmath> + +int main() +{ + Cairo::RefPtr<Cairo::ImageSurface> surface = + Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, 600, 400); + + Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create(surface); + + cr->save(); // save the state of the context + cr->set_source_rgb(0.86, 0.85, 0.47); + cr->paint(); // fill image with the color + cr->restore(); // color is back to black now + + cr->save(); + // draw a border around the image + cr->set_line_width(20.0); // make the line wider + cr->rectangle(0.0, 0.0, surface->get_width(), surface->get_height()); + cr->stroke(); + + cr->set_source_rgba(0.0, 0.0, 0.0, 0.7); + // draw a circle in the center of the image + cr->arc(surface->get_width() / 2.0, surface->get_height() / 2.0, + surface->get_height() / 4.0, 0.0, 2.0 * M_PI); + cr->stroke(); + + // draw a diagonal line + cr->move_to(surface->get_width() / 4.0, surface->get_height() / 4.0); + cr->line_to(surface->get_width() * 3.0 / 4.0, surface->get_height() * 3.0 / 4.0); + cr->stroke(); + cr->restore(); + +#ifdef CAIRO_HAS_PNG_FUNCTIONS + + std::string filename = "image.png"; + surface->write_to_png(filename); + + std::cout << "Wrote png file \"" << filename << "\"" << std::endl; + +#else + + std::cout << "You must compile cairo with PNG support for this example to work." + << std::endl; + +#endif +} diff --git a/Tests/FindGTK2/gdk/CMakeLists.txt b/Tests/FindGTK2/gdk/CMakeLists.txt new file mode 100644 index 0000000..f485236 --- /dev/null +++ b/Tests/FindGTK2/gdk/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(gdk C) + +find_package(GTK2 COMPONENTS gtk REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(gdk WIN32 main.c) +target_link_libraries(gdk GTK2::gdk) diff --git a/Tests/FindGTK2/gdk/main.c b/Tests/FindGTK2/gdk/main.c new file mode 100644 index 0000000..ac1bd4b --- /dev/null +++ b/Tests/FindGTK2/gdk/main.c @@ -0,0 +1,7 @@ +#include <gdk/gdk.h> + +int main(int argc, char *argv[]) +{ + gdk_init(argc, argv); + return 0; +} diff --git a/Tests/FindGTK2/gdk_pixbuf/CMakeLists.txt b/Tests/FindGTK2/gdk_pixbuf/CMakeLists.txt new file mode 100644 index 0000000..004e82e --- /dev/null +++ b/Tests/FindGTK2/gdk_pixbuf/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(gdk_pixbuf C) + +find_package(GTK2 COMPONENTS gtk REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(gdk_pixbuf WIN32 main.c) +target_link_libraries(gdk_pixbuf GTK2::gdk_pixbuf) diff --git a/Tests/FindGTK2/gdk_pixbuf/main.c b/Tests/FindGTK2/gdk_pixbuf/main.c new file mode 100644 index 0000000..e42b83e --- /dev/null +++ b/Tests/FindGTK2/gdk_pixbuf/main.c @@ -0,0 +1,10 @@ +#include <gdk-pixbuf/gdk-pixbuf.h> + +int main(int argc, char *argv[]) +{ + const char *version = gdk_pixbuf_version; + const guint major = gdk_pixbuf_major_version; + const guint minor = gdk_pixbuf_minor_version; + const guint micro = gdk_pixbuf_micro_version; + return 0; +} diff --git a/Tests/FindGTK2/gdkmm/CMakeLists.txt b/Tests/FindGTK2/gdkmm/CMakeLists.txt new file mode 100644 index 0000000..a54fc4f --- /dev/null +++ b/Tests/FindGTK2/gdkmm/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(gdkmm CXX) + +find_package(GTK2 COMPONENTS gtk gtkmm REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(gdkmm WIN32 main.cpp) +target_link_libraries(gdkmm GTK2::gdkmm) diff --git a/Tests/FindGTK2/gdkmm/main.cpp b/Tests/FindGTK2/gdkmm/main.cpp new file mode 100644 index 0000000..935bcc4 --- /dev/null +++ b/Tests/FindGTK2/gdkmm/main.cpp @@ -0,0 +1,7 @@ +#include <gdkmm.h> + +int main(int argc, char *argv[]) +{ + Gdk::Color red = Gdk::Color("red"); + return 0; +} diff --git a/Tests/FindGTK2/gio/CMakeLists.txt b/Tests/FindGTK2/gio/CMakeLists.txt new file mode 100644 index 0000000..db9cdd0 --- /dev/null +++ b/Tests/FindGTK2/gio/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(gio C) + +find_package(GTK2 COMPONENTS gtk REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(gio WIN32 main.c) +target_link_libraries(gio GTK2::gio) diff --git a/Tests/FindGTK2/gio/main.c b/Tests/FindGTK2/gio/main.c new file mode 100644 index 0000000..13f4304 --- /dev/null +++ b/Tests/FindGTK2/gio/main.c @@ -0,0 +1,8 @@ +#include <gio/gio.h> + +int main(int argc, char *argv[]) +{ + GFile *file = g_file_new_for_path("path"); + g_object_unref(file); + return 0; +} diff --git a/Tests/FindGTK2/giomm/CMakeLists.txt b/Tests/FindGTK2/giomm/CMakeLists.txt new file mode 100644 index 0000000..46cfef5 --- /dev/null +++ b/Tests/FindGTK2/giomm/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(giomm CXX) + +find_package(GTK2 COMPONENTS gtk gtkmm REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(giomm WIN32 main.cpp) +target_link_libraries(giomm GTK2::giomm) diff --git a/Tests/FindGTK2/giomm/main.cpp b/Tests/FindGTK2/giomm/main.cpp new file mode 100644 index 0000000..8303ba9 --- /dev/null +++ b/Tests/FindGTK2/giomm/main.cpp @@ -0,0 +1,7 @@ +#include <giomm.h> + +int main(int argc, char *argv[]) +{ + Glib::RefPtr<Gio::File> f = Gio::File::create_for_path("path"); + return 0; +} diff --git a/Tests/FindGTK2/glib/CMakeLists.txt b/Tests/FindGTK2/glib/CMakeLists.txt new file mode 100644 index 0000000..1aa73ff --- /dev/null +++ b/Tests/FindGTK2/glib/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(glib C) + +find_package(GTK2 COMPONENTS gtk REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(glib WIN32 main.c) +target_link_libraries(glib GTK2::glib) diff --git a/Tests/FindGTK2/glib/main.c b/Tests/FindGTK2/glib/main.c new file mode 100644 index 0000000..80d0554 --- /dev/null +++ b/Tests/FindGTK2/glib/main.c @@ -0,0 +1,11 @@ +#include <glib.h> + +int main(int argc, char *argv[]) +{ + if (!g_file_test("file", G_FILE_TEST_EXISTS)) { + g_print("File not found. \n"); + } else { + g_print("File found. \n"); + } + return 0; +} diff --git a/Tests/FindGTK2/glibmm/CMakeLists.txt b/Tests/FindGTK2/glibmm/CMakeLists.txt new file mode 100644 index 0000000..af8ddcf --- /dev/null +++ b/Tests/FindGTK2/glibmm/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(glibmm CXX) + +find_package(GTK2 COMPONENTS gtk gtkmm REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(glibmm WIN32 main.cpp) +target_link_libraries(glibmm GTK2::glibmm) diff --git a/Tests/FindGTK2/glibmm/main.cpp b/Tests/FindGTK2/glibmm/main.cpp new file mode 100644 index 0000000..0e8cdae --- /dev/null +++ b/Tests/FindGTK2/glibmm/main.cpp @@ -0,0 +1,7 @@ +#include <glibmm/init.h> + +int main(int, char**) +{ + Glib::init(); + return 0; +} diff --git a/Tests/FindGTK2/gmodule/CMakeLists.txt b/Tests/FindGTK2/gmodule/CMakeLists.txt new file mode 100644 index 0000000..9717da8 --- /dev/null +++ b/Tests/FindGTK2/gmodule/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(gmodule C) + +find_package(GTK2 COMPONENTS gtk REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(gmodule WIN32 main.c) +target_link_libraries(gmodule GTK2::gmodule) diff --git a/Tests/FindGTK2/gmodule/main.c b/Tests/FindGTK2/gmodule/main.c new file mode 100644 index 0000000..5c85a6f --- /dev/null +++ b/Tests/FindGTK2/gmodule/main.c @@ -0,0 +1,7 @@ +#include <gmodule.h> + +int main(int argc, char *argv[]) +{ + gboolean b = g_module_supported(); + return 0; +} diff --git a/Tests/FindGTK2/gobject/CMakeLists.txt b/Tests/FindGTK2/gobject/CMakeLists.txt new file mode 100644 index 0000000..c51fd4d --- /dev/null +++ b/Tests/FindGTK2/gobject/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(gobject C) + +find_package(GTK2 COMPONENTS gtk REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(gobject WIN32 main.c) +target_link_libraries(gobject GTK2::gobject) diff --git a/Tests/FindGTK2/gobject/main.c b/Tests/FindGTK2/gobject/main.c new file mode 100644 index 0000000..d3e13f9 --- /dev/null +++ b/Tests/FindGTK2/gobject/main.c @@ -0,0 +1,72 @@ +/* Taken from https://developer.gnome.org/gobject/stable/chapter-gobject.html */ + + +#include <glib-object.h> + + +#define MAMAN_TYPE_BAR (maman_bar_get_type ()) +#define MAMAN_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_BAR, MamanBar)) +#define MAMAN_IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_BAR)) +#define MAMAN_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_BAR, MamanBarClass)) +#define MAMAN_IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_BAR)) +#define MAMAN_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_BAR, MamanBarClass)) + +typedef struct _MamanBar MamanBar; +typedef struct _MamanBarClass MamanBarClass; + +struct _MamanBar +{ + GObject parent_instance; + + /* instance members */ +}; + +struct _MamanBarClass +{ + GObjectClass parent_class; + + /* class members */ +}; + +/* will create maman_bar_get_type and set maman_bar_parent_class */ +G_DEFINE_TYPE (MamanBar, maman_bar, G_TYPE_OBJECT); + +static GObject * +maman_bar_constructor (GType gtype, + guint n_properties, + GObjectConstructParam *properties) +{ + GObject *obj; + + { + /* Always chain up to the parent constructor */ + obj = G_OBJECT_CLASS (maman_bar_parent_class)->constructor (gtype, n_properties, properties); + } + + /* update the object state depending on constructor properties */ + + return obj; +} + +static void +maman_bar_class_init (MamanBarClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + + gobject_class->constructor = maman_bar_constructor; +} + +static void +maman_bar_init (MamanBar *self) +{ + /* initialize the object */ +} + + +int +main(int argc, char *argv[]) +{ + MamanBar *bar = g_object_new (MAMAN_TYPE_BAR, NULL); + g_object_unref(bar); + return 0; +} diff --git a/Tests/FindGTK2/gthread/CMakeLists.txt b/Tests/FindGTK2/gthread/CMakeLists.txt new file mode 100644 index 0000000..a90294d0 --- /dev/null +++ b/Tests/FindGTK2/gthread/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(gthread C) + +find_package(GTK2 COMPONENTS gtk REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(gthread WIN32 main.c) +target_link_libraries(gthread GTK2::gthread) diff --git a/Tests/FindGTK2/gthread/main.c b/Tests/FindGTK2/gthread/main.c new file mode 100644 index 0000000..ce68cbd --- /dev/null +++ b/Tests/FindGTK2/gthread/main.c @@ -0,0 +1,7 @@ +#include <glib.h> + +int main(int argc, char *argv[]) +{ + g_thread_init(NULL); + return 0; +} diff --git a/Tests/FindGTK2/gtk/CMakeLists.txt b/Tests/FindGTK2/gtk/CMakeLists.txt new file mode 100644 index 0000000..11603ae --- /dev/null +++ b/Tests/FindGTK2/gtk/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 2.8) + +project(gtk C) + +find_package(GTK2 COMPONENTS gtk REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(gtk WIN32 main.c) +target_link_libraries(gtk GTK2::gtk) + +add_executable(gtk-all-libs WIN32 main.c) +target_link_libraries(gtk-all-libs ${GTK2_LIBRARIES}) +target_include_directories(gtk-all-libs PRIVATE ${GTK2_INCLUDE_DIRS}) diff --git a/Tests/FindGTK2/gtk/main.c b/Tests/FindGTK2/gtk/main.c new file mode 100644 index 0000000..309c328 --- /dev/null +++ b/Tests/FindGTK2/gtk/main.c @@ -0,0 +1,15 @@ +#include <gtk/gtk.h> + +int main(int argc, char *argv[]) +{ + GtkWidget *window; + + gtk_init (&argc, &argv); + + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_widget_show (window); + + gtk_main (); + + return 0; +} diff --git a/Tests/FindGTK2/gtkmm/CMakeLists.txt b/Tests/FindGTK2/gtkmm/CMakeLists.txt new file mode 100644 index 0000000..32aafe2 --- /dev/null +++ b/Tests/FindGTK2/gtkmm/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 2.8) + +project(gtkmm CXX) + +find_package(GTK2 COMPONENTS gtk gtkmm REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(gtkmm-target WIN32 main.cpp helloworld.cpp helloworld.h) +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}) diff --git a/Tests/FindGTK2/gtkmm/helloworld.cpp b/Tests/FindGTK2/gtkmm/helloworld.cpp new file mode 100644 index 0000000..535f44a --- /dev/null +++ b/Tests/FindGTK2/gtkmm/helloworld.cpp @@ -0,0 +1,29 @@ +#include "helloworld.h" +#include <iostream> + +HelloWorld::HelloWorld() + : m_button("Hello World") // creates a new button with label "Hello World". +{ + // Sets the border width of the window. + set_border_width(10); + + // When the button receives the "clicked" signal, it will call the + // on_button_clicked() method defined below. + m_button.signal_clicked().connect(sigc::mem_fun(*this, + &HelloWorld::on_button_clicked)); + + // This packs the button into the Window (a container). + add(m_button); + + // The final step is to display this newly created widget... + m_button.show(); +} + +HelloWorld::~HelloWorld() +{ +} + +void HelloWorld::on_button_clicked() +{ + std::cout << "Hello World" << std::endl; +} diff --git a/Tests/FindGTK2/gtkmm/helloworld.h b/Tests/FindGTK2/gtkmm/helloworld.h new file mode 100644 index 0000000..ab9a076 --- /dev/null +++ b/Tests/FindGTK2/gtkmm/helloworld.h @@ -0,0 +1,20 @@ +#ifndef GTKMM_EXAMPLE_HELLOWORLD_H +#define GTKMM_EXAMPLE_HELLOWORLD_H + +#include <gtkmm.h> + +class HelloWorld : public Gtk::Window +{ +public: + HelloWorld(); + virtual ~HelloWorld(); + +protected: + //Signal handlers: + void on_button_clicked(); + + //Member widgets: + Gtk::Button m_button; +}; + +#endif // GTKMM_EXAMPLE_HELLOWORLD_H diff --git a/Tests/FindGTK2/gtkmm/main.cpp b/Tests/FindGTK2/gtkmm/main.cpp new file mode 100644 index 0000000..5ff64d1 --- /dev/null +++ b/Tests/FindGTK2/gtkmm/main.cpp @@ -0,0 +1,13 @@ +#include <gtkmm.h> +#include "helloworld.h" + +int main(int argc, char *argv[]) +{ + Gtk::Main kit(argc, argv); + + HelloWorld helloworld; + //Shows the window and returns when it is closed. + Gtk::Main::run(helloworld); + + return 0; +} diff --git a/Tests/FindGTK2/pango/CMakeLists.txt b/Tests/FindGTK2/pango/CMakeLists.txt new file mode 100644 index 0000000..af382a4 --- /dev/null +++ b/Tests/FindGTK2/pango/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(pango C) + +find_package(GTK2 COMPONENTS gtk REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(pango WIN32 main.c) +target_link_libraries(pango GTK2::pango) diff --git a/Tests/FindGTK2/pango/main.c b/Tests/FindGTK2/pango/main.c new file mode 100644 index 0000000..ef87ce4 --- /dev/null +++ b/Tests/FindGTK2/pango/main.c @@ -0,0 +1,7 @@ +#include <pango/pango.h> + +int main(int argc, char *argv[]) +{ + gboolean ret = pango_color_parse(NULL, "#ffffff"); + return 0; +} diff --git a/Tests/FindGTK2/pangocairo/CMakeLists.txt b/Tests/FindGTK2/pangocairo/CMakeLists.txt new file mode 100644 index 0000000..8f61379 --- /dev/null +++ b/Tests/FindGTK2/pangocairo/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(pangocairo C) + +find_package(GTK2 COMPONENTS gtk REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(pangocairo WIN32 main.c) +target_link_libraries(pangocairo GTK2::pangocairo m) diff --git a/Tests/FindGTK2/pangocairo/main.c b/Tests/FindGTK2/pangocairo/main.c new file mode 100644 index 0000000..78268d6 --- /dev/null +++ b/Tests/FindGTK2/pangocairo/main.c @@ -0,0 +1,72 @@ +/* Taken from https://developer.gnome.org/pango/stable/pango-Cairo-Rendering.html */ + + +#include <math.h> +#include <pango/pangocairo.h> +static void +draw_text (cairo_t *cr) +{ +#define RADIUS 150 +#define N_WORDS 10 +#define FONT "Sans Bold 27" + PangoLayout *layout; + PangoFontDescription *desc; + int i; + /* Center coordinates on the middle of the region we are drawing + */ + cairo_translate (cr, RADIUS, RADIUS); + /* Create a PangoLayout, set the font and text */ + layout = pango_cairo_create_layout (cr); + pango_layout_set_text (layout, "Text", -1); + desc = pango_font_description_from_string (FONT); + pango_layout_set_font_description (layout, desc); + pango_font_description_free (desc); + /* Draw the layout N_WORDS times in a circle */ + for (i = 0; i < N_WORDS; i++) + { + int width, height; + double angle = (360. * i) / N_WORDS; + double red; + cairo_save (cr); + /* Gradient from red at angle == 60 to blue at angle == 240 */ + red = (1 + cos ((angle - 60) * G_PI / 180.)) / 2; + cairo_set_source_rgb (cr, red, 0, 1.0 - red); + cairo_rotate (cr, angle * G_PI / 180.); + /* Inform Pango to re-layout the text with the new transformation */ + pango_cairo_update_layout (cr, layout); + pango_layout_get_size (layout, &width, &height); + cairo_move_to (cr, - ((double)width / PANGO_SCALE) / 2, - RADIUS); + pango_cairo_show_layout (cr, layout); + cairo_restore (cr); + } + /* free the layout object */ + g_object_unref (layout); +} +int main (int argc, char **argv) +{ + cairo_t *cr; + char *filename; + cairo_status_t status; + cairo_surface_t *surface; + if (argc != 2) + { + g_printerr ("Usage: cairosimple OUTPUT_FILENAME\n"); + return 1; + } + filename = argv[1]; + surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, + 2 * RADIUS, 2 * RADIUS); + cr = cairo_create (surface); + cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); + cairo_paint (cr); + draw_text (cr); + cairo_destroy (cr); + status = cairo_surface_write_to_png (surface, filename); + cairo_surface_destroy (surface); + if (status != CAIRO_STATUS_SUCCESS) + { + g_printerr ("Could not save png to '%s'\n", filename); + return 1; + } + return 0; +} diff --git a/Tests/FindGTK2/pangoft2/CMakeLists.txt b/Tests/FindGTK2/pangoft2/CMakeLists.txt new file mode 100644 index 0000000..0f84c7f --- /dev/null +++ b/Tests/FindGTK2/pangoft2/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(pangoft2 C) + +find_package(GTK2 COMPONENTS gtk REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(pangoft2 WIN32 main.c) +target_link_libraries(pangoft2 GTK2::pangoft2) diff --git a/Tests/FindGTK2/pangoft2/main.c b/Tests/FindGTK2/pangoft2/main.c new file mode 100644 index 0000000..cf3459e --- /dev/null +++ b/Tests/FindGTK2/pangoft2/main.c @@ -0,0 +1,8 @@ +#include <pango/pangoft2.h> + +int main(int argc, char *argv[]) +{ + PangoFontMap* pfm = pango_ft2_font_map_new(); + g_object_unref(pfm); + return 0; +} diff --git a/Tests/FindGTK2/pangomm/CMakeLists.txt b/Tests/FindGTK2/pangomm/CMakeLists.txt new file mode 100644 index 0000000..3650c50 --- /dev/null +++ b/Tests/FindGTK2/pangomm/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(pangomm CXX) + +find_package(GTK2 COMPONENTS gtk gtkmm REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(pangomm WIN32 main.cpp) +target_link_libraries(pangomm GTK2::pangomm) diff --git a/Tests/FindGTK2/pangomm/main.cpp b/Tests/FindGTK2/pangomm/main.cpp new file mode 100644 index 0000000..32ec914 --- /dev/null +++ b/Tests/FindGTK2/pangomm/main.cpp @@ -0,0 +1,8 @@ +#include <pangomm.h> +#include <pangomm/init.h> + +int main(int argc, char *argv[]) +{ + Pango::init(); + return 0; +} diff --git a/Tests/FindGTK2/pangoxft/CMakeLists.txt b/Tests/FindGTK2/pangoxft/CMakeLists.txt new file mode 100644 index 0000000..0db16b1 --- /dev/null +++ b/Tests/FindGTK2/pangoxft/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(pangoxft C) + +find_package(GTK2 COMPONENTS gtk REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(pangoxft WIN32 main.c) +target_link_libraries(pangoxft GTK2::pangoxft) diff --git a/Tests/FindGTK2/pangoxft/main.c b/Tests/FindGTK2/pangoxft/main.c new file mode 100644 index 0000000..cb04f61 --- /dev/null +++ b/Tests/FindGTK2/pangoxft/main.c @@ -0,0 +1,7 @@ +#include <pango/pangoxft.h> + +int main(int argc, char *argv[]) +{ + pango_xft_get_context(NULL, 0); + return 0; +} diff --git a/Tests/FindGTK2/sigc++/CMakeLists.txt b/Tests/FindGTK2/sigc++/CMakeLists.txt new file mode 100644 index 0000000..f830b81 --- /dev/null +++ b/Tests/FindGTK2/sigc++/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(sigc++ CXX) + +find_package(GTK2 COMPONENTS gtk gtkmm REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(sigc++ WIN32 main.cpp) +target_link_libraries(sigc++ GTK2::sigc++) diff --git a/Tests/FindGTK2/sigc++/main.cpp b/Tests/FindGTK2/sigc++/main.cpp new file mode 100644 index 0000000..78428e7 --- /dev/null +++ b/Tests/FindGTK2/sigc++/main.cpp @@ -0,0 +1,30 @@ +// Taken from https://developer.gnome.org/libsigc++-tutorial/stable/ch02.html + + +#include <sigc++/sigc++.h> +#include <iostream> + +class AlienDetector +{ +public: + AlienDetector() {} + + void run() {} + + sigc::signal<void> signal_detected; +}; + +void warn_people() +{ + std::cout << "There are aliens in the carpark!" << std::endl; +} + +int main() +{ + AlienDetector mydetector; + mydetector.signal_detected.connect( sigc::ptr_fun(warn_people) ); + + mydetector.run(); + + return 0; +} diff --git a/Tests/FindPackageModeMakefileTest/CMakeLists.txt b/Tests/FindPackageModeMakefileTest/CMakeLists.txt index 3674f0e..5d1b376 100644 --- a/Tests/FindPackageModeMakefileTest/CMakeLists.txt +++ b/Tests/FindPackageModeMakefileTest/CMakeLists.txt @@ -19,8 +19,16 @@ if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Makefile") configure_file(FindFoo.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FindFoo.cmake @ONLY) # now set up the test: - get_target_property(cmakeExecutable cmake LOCATION) - + if (NOT CMAKE_VERSION VERSION_LESS 2.8.12) + file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cmakeExecutable.mk" + CONTENT "CMAKE = \"$<TARGET_FILE:cmake>\"\n" + ) + else() + get_target_property(cmakeLocation cmake LOCATION) + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cmakeExecutable.mk" + "CMAKE = \"${cmakeLocation}\"\n" + ) + endif() configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Makefile.in ${CMAKE_CURRENT_BINARY_DIR}/ConfMakefile @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/main.cpp ${CMAKE_CURRENT_BINARY_DIR}/main.cpp COPYONLY) diff --git a/Tests/FindPackageModeMakefileTest/Makefile.in b/Tests/FindPackageModeMakefileTest/Makefile.in index f647901..e4df9d6 100644 --- a/Tests/FindPackageModeMakefileTest/Makefile.in +++ b/Tests/FindPackageModeMakefileTest/Makefile.in @@ -1,4 +1,6 @@ -CMAKE = "@cmakeExecutable@" + +include cmakeExecutable.mk + CMAKE_CURRENT_BINARY_DIR = "@CMAKE_CURRENT_BINARY_DIR@" CMAKE_CXX_COMPILER = "@CMAKE_CXX_COMPILER@" CMAKE_CXX_COMPILER_ID = "@CMAKE_CXX_COMPILER_ID@" @@ -7,9 +9,9 @@ CMAKE_FOO = $(CMAKE) --find-package -DCMAKE_MODULE_PATH=$(CMAKE_CURRENT_BINARY_D tmp = tmp.txt -all: clean pngtest +all: pngtest -main.o: main.cpp +main.o: clean main.cpp @$(CMAKE_FOO) -DMODE=COMPILE >$(tmp) @foo="`cat $(tmp)`"; \ printf '"%s" %s %s -c main.cpp\n' $(CMAKE_CXX_COMPILER) "$(CXXFLAGS)" "$$foo" >$(tmp) diff --git a/Tests/Fortran/CMakeLists.txt b/Tests/Fortran/CMakeLists.txt index cda5fed..adc4308 100644 --- a/Tests/Fortran/CMakeLists.txt +++ b/Tests/Fortran/CMakeLists.txt @@ -1,5 +1,9 @@ cmake_minimum_required (VERSION 2.6) project(testf C CXX Fortran) +if(NOT DEFINED CMAKE_TEST_MAKEPROGRAM AND NOT CMAKE_GENERATOR MATCHES "Visual Studio") + set(CMAKE_TEST_MAKEPROGRAM "${CMAKE_MAKE_PROGRAM}") +endif() + message("CTEST_FULL_OUTPUT ") set(CMAKE_VERBOSE_MAKEFILE 1) message("ENV_FLAGS = $ENV{FFLAGS}") @@ -198,13 +202,13 @@ if(TEST_MODULE_DEPENDS) --build-project ExtFort --build-generator ${CMAKE_GENERATOR} --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" - --build-makeprogram ${CMAKE_MAKE_PROGRAM} --build-options -DCMAKE_Fortran_COMPILER:STRING=${CMAKE_Fortran_COMPILER} -DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS} -DCMAKE_Fortran_FLAGS_DEBUG:STRING=${CMAKE_Fortran_FLAGS_DEBUG} -DCMAKE_Fortran_FLAGS_RELEASE:STRING=${CMAKE_Fortran_FLAGS_RELEASE} -DCMAKE_Fortran_FLAGS_MINSIZEREL:STRING=${CMAKE_Fortran_FLAGS_MINSIZEREL} -DCMAKE_Fortran_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_Fortran_FLAGS_RELWITHDEBINFO} + -DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM} ${External_BUILD_TYPE} VERBATIM ) diff --git a/Tests/GeneratorExpression/CMP0044/CMakeLists.txt b/Tests/GeneratorExpression/CMP0044/CMakeLists.txt new file mode 100644 index 0000000..309a8cc --- /dev/null +++ b/Tests/GeneratorExpression/CMP0044/CMakeLists.txt @@ -0,0 +1,19 @@ + +string(TOLOWER ${CMAKE_C_COMPILER_ID} lc_test) +if (lc_test STREQUAL CMAKE_C_COMPILER_ID) + string(TOUPPER ${CMAKE_C_COMPILER_ID} lc_test) + if (lc_test STREQUAL CMAKE_C_COMPILER_ID) + message(SEND_ERROR "Try harder.") + endif() +endif() + +if (CMP0044_TYPE) + cmake_policy(SET CMP0044 ${CMP0044_TYPE}) +endif() + +add_library(cmp0044-check-${CMP0044_TYPE} cmp0044-check.cpp) +target_compile_definitions(cmp0044-check-${CMP0044_TYPE} + PRIVATE + Result=$<C_COMPILER_ID:${lc_test}> + Type_Is_${CMP0044_TYPE} +) diff --git a/Tests/GeneratorExpression/CMP0044/cmp0044-check.cpp b/Tests/GeneratorExpression/CMP0044/cmp0044-check.cpp new file mode 100644 index 0000000..2356bc4 --- /dev/null +++ b/Tests/GeneratorExpression/CMP0044/cmp0044-check.cpp @@ -0,0 +1,26 @@ + +#ifdef Type_Is_ +# if !Result +# error Result should be 1 in WARN mode +# endif +#endif + +#ifdef Type_Is_NEW +# if Result +# error Result should be 0 in NEW mode +# endif +#endif + +#ifdef Type_Is_OLD +# if !Result +# error Result should be 1 in OLD mode +# endif +#endif + +#if !defined(Type_Is_) && !defined(Type_Is_OLD) && !defined(Type_Is_NEW) +#error No expected definition present +#endif + +void foo(void) +{ +} diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt index 4d8d7ed..a0e34ef 100644 --- a/Tests/GeneratorExpression/CMakeLists.txt +++ b/Tests/GeneratorExpression/CMakeLists.txt @@ -1,5 +1,7 @@ cmake_minimum_required (VERSION 2.8.8) -project(GeneratorExpression CXX) +project(GeneratorExpression) + +include(CTest) # This test is split into multiple parts as needed to avoid NMake command # length limits. @@ -11,6 +13,7 @@ add_custom_target(check-part1 ALL -Dtest_1=$<1:content> -Dtest_1_with_comma=$<1:-Wl,--no-undefined> -Dconfig=$<CONFIGURATION> + -Dshort_config=$<CONFIG> -Dtest_and_0=$<AND:0> -Dtest_and_0_0=$<AND:0,0> -Dtest_and_0_1=$<AND:0,1> @@ -186,7 +189,72 @@ add_custom_target(check-part3 ALL -Dtest_alias_target_name=$<STREQUAL:$<TARGET_PROPERTY:Alias::SomeLib,NAME>,$<TARGET_PROPERTY:empty1,NAME>> -Dtest_early_termination_1=$<$<1:>: -Dtest_early_termination_2=$<$<1:>:, + -Dsystem_name=${CMAKE_HOST_SYSTEM_NAME} + -Dtest_platform_id=$<PLATFORM_ID> + -Dtest_platform_id_Linux=$<PLATFORM_ID:Linux> + -Dtest_platform_id_Windows=$<PLATFORM_ID:Windows> + -Dtest_platform_id_Darwin=$<PLATFORM_ID:Darwin> + -Dlower_case=$<LOWER_CASE:Mi,XeD> + -Dupper_case=$<UPPER_CASE:MiX,eD> + -Dmake_c_identifier=$<MAKE_C_IDENTIFIER:4f,oo:+bar-$> + -Dequal1=$<EQUAL:1,2> + -Dequal2=$<EQUAL:1,1> + -Dequal3=$<EQUAL:0x1,1> + -Dequal4=$<EQUAL:0X1,2> + -Dequal5=$<EQUAL:0xA,0xa> + -Dequal6=$<EQUAL:0xA,10> + -Dequal7=$<EQUAL:0xA,012> + -Dequal8=$<EQUAL:10,012> + -Dequal9=$<EQUAL:10,010> + -Dequal10=$<EQUAL:10,0b1010> + -Dequal11=$<EQUAL:-10,-0xa> + -Dequal12=$<EQUAL:10,+0xa> + -Dequal13=$<EQUAL:+10,+0Xa> + -Dequal14=$<EQUAL:+10,0xa> + -Dequal15=$<EQUAL:-10,-0Xa> + -Dequal16=$<EQUAL:-10,-0b1010> + -Dequal17=$<EQUAL:-10,+0b1010> + -Dequal18=$<EQUAL:10,+0B1010> + -Dequal19=$<EQUAL:10,-0B1010> + -Dequal20=$<EQUAL:10,0B1010> + -Dequal21=$<EQUAL:10,+012> + -Dequal22=$<EQUAL:10,-012> + -Dequal23=$<EQUAL:-10,-012> -P ${CMAKE_CURRENT_SOURCE_DIR}/check-part3.cmake COMMAND ${CMAKE_COMMAND} -E echo "check done (part 3 of 3)" VERBATIM ) + +#----------------------------------------------------------------------------- +# Cover test properties with generator expressions. +add_executable(echo echo.c) +add_executable(pwd pwd.c) + +add_test(NAME echo-configuration COMMAND echo $<CONFIGURATION>) +set_property(TEST echo-configuration PROPERTY + PASS_REGULAR_EXPRESSION "^$<CONFIGURATION>\n$") + +add_test(NAME echo-target-file COMMAND echo $<TARGET_FILE:echo>) +set_property(TEST echo-target-file PROPERTY + PASS_REGULAR_EXPRESSION "/echo${CMAKE_EXECUTABLE_SUFFIX}\n$") +set_property(TEST echo-target-file PROPERTY + REQUIRED_FILES "$<TARGET_FILE:echo>") + +add_test(NAME working-dir-arg + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/WorkingDirectory/$<CONFIGURATION>" + COMMAND pwd) +set_property(TEST working-dir-arg PROPERTY + PASS_REGULAR_EXPRESSION "WorkingDirectory/$<CONFIGURATION>\n$") +foreach(c ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE}) + file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/WorkingDirectory/${c}") +endforeach() + +add_test(echo-old-style echo "\$<CONFIGURATION>") +set_property(TEST echo-old-style PROPERTY + PASS_REGULAR_EXPRESSION "^\\$<CONFIGURATION>\n$") + +add_subdirectory(CMP0044 ${CMAKE_BINARY_DIR}/CMP0044-WARN) +set(CMP0044_TYPE NEW) +add_subdirectory(CMP0044 ${CMAKE_BINARY_DIR}/CMP0044-NEW) +set(CMP0044_TYPE OLD) +add_subdirectory(CMP0044 ${CMAKE_BINARY_DIR}/CMP0044-OLD) diff --git a/Tests/GeneratorExpression/check-part1.cmake b/Tests/GeneratorExpression/check-part1.cmake index 9bef159..3207582 100644 --- a/Tests/GeneratorExpression/check-part1.cmake +++ b/Tests/GeneratorExpression/check-part1.cmake @@ -2,6 +2,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/check-common.cmake) message(STATUS "config=[${config}]") +check(config "${short_config}") check(test_0 "") check(test_0_with_comma "") check(test_1 "content") diff --git a/Tests/GeneratorExpression/check-part3.cmake b/Tests/GeneratorExpression/check-part3.cmake index 74a596c..70ccfe1 100644 --- a/Tests/GeneratorExpression/check-part3.cmake +++ b/Tests/GeneratorExpression/check-part3.cmake @@ -26,3 +26,37 @@ check(test_alias_file_lib "1") check(test_alias_target_name "1") check(test_early_termination_1 "$<:") check(test_early_termination_2 "$<:,") +check(test_platform_id "${system_name}") +foreach(system Linux Windows Darwin) + if(system_name STREQUAL system) + check(test_platform_id_${system} 1) + else() + check(test_platform_id_${system} 0) + endif() +endforeach() +check(lower_case "mi,xed") +check(upper_case "MIX,ED") +check(make_c_identifier "_4f_oo__bar__") +check(equal1 "0") +check(equal2 "1") +check(equal3 "1") +check(equal4 "0") +check(equal5 "1") +check(equal6 "1") +check(equal7 "1") +check(equal8 "1") +check(equal9 "0") +check(equal10 "1") +check(equal11 "1") +check(equal12 "1") +check(equal13 "1") +check(equal14 "1") +check(equal15 "1") +check(equal16 "1") +check(equal17 "0") +check(equal18 "1") +check(equal19 "0") +check(equal20 "1") +check(equal21 "1") +check(equal22 "0") +check(equal23 "1") diff --git a/Tests/GeneratorExpression/echo.c b/Tests/GeneratorExpression/echo.c new file mode 100644 index 0000000..06b0844 --- /dev/null +++ b/Tests/GeneratorExpression/echo.c @@ -0,0 +1,8 @@ +#include <stdio.h> +#include <stdlib.h> + +int main(int argc, char* argv[]) +{ + printf("%s\n", argv[1]); + return EXIT_SUCCESS; +} diff --git a/Tests/GeneratorExpression/pwd.c b/Tests/GeneratorExpression/pwd.c new file mode 100644 index 0000000..054b1af --- /dev/null +++ b/Tests/GeneratorExpression/pwd.c @@ -0,0 +1,34 @@ +#include <limits.h> +#include <stdio.h> +#include <stdlib.h> + +#ifdef _WIN32 +#include <direct.h> +#define getcurdir _getcwd +#else +#include <unistd.h> +#define getcurdir getcwd +#endif + +int main(int argc, char* argv[]) +{ +#define BUFSZ 20000 + char buf[BUFSZ + 1]; +#ifdef _WIN32 + char *pos; +#endif + getcurdir(buf, BUFSZ); +#ifdef _WIN32 + pos = buf; + while (*pos) + { + if (*pos == '\\') + { + *pos = '/'; + } + ++pos; + } +#endif + printf("%s\n", buf); + return EXIT_SUCCESS; +} diff --git a/Tests/IncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/CMakeLists.txt index 35ad8dc..9ee1957 100644 --- a/Tests/IncludeDirectories/CMakeLists.txt +++ b/Tests/IncludeDirectories/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 2.6) project(IncludeDirectories) if (((CMAKE_C_COMPILER_ID STREQUAL GNU AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.4) - OR CMAKE_C_COMPILER_ID STREQUAL Clang) + OR CMAKE_C_COMPILER_ID STREQUAL Clang OR CMAKE_C_COMPILER_ID STREQUAL AppleClang) AND (CMAKE_GENERATOR STREQUAL "Unix Makefiles" OR CMAKE_GENERATOR STREQUAL "Ninja")) include(CheckCXXCompilerFlag) check_cxx_compiler_flag(-Wunused-variable run_sys_includes_test) diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt index aec6ff9..abe9f74 100644 --- a/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt +++ b/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt @@ -17,3 +17,35 @@ target_include_directories(upstream SYSTEM PUBLIC add_library(consumer consumer.cpp) target_link_libraries(consumer upstream) target_compile_options(consumer PRIVATE -Werror=unused-variable) + +add_library(iface IMPORTED INTERFACE) +set_property(TARGET iface PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/systemlib_header_only") + +add_library(imported_consumer imported_consumer.cpp) +target_link_libraries(imported_consumer iface) +target_compile_options(imported_consumer PRIVATE -Werror=unused-variable) + +add_library(imported_consumer2 imported_consumer.cpp) +target_link_libraries(imported_consumer2 imported_consumer) +target_compile_options(imported_consumer2 PRIVATE -Werror=unused-variable) + +macro(do_try_compile error_option) + set(TC_ARGS + IFACE_TRY_COMPILE_${error_option} + "${CMAKE_CURRENT_BINARY_DIR}/try_compile_iface" "${CMAKE_CURRENT_SOURCE_DIR}/imported_consumer.cpp" + LINK_LIBRARIES iface + ) + if (${error_option} STREQUAL WITH_ERROR) + list(APPEND TC_ARGS COMPILE_DEFINITIONS -Werror=unused-variable) + endif() + try_compile(${TC_ARGS}) +endmacro() + +do_try_compile(NO_ERROR) +if (NOT IFACE_TRY_COMPILE_NO_ERROR) + message(SEND_ERROR "try_compile failed with imported target.") +endif() +do_try_compile(WITH_ERROR) +if (NOT IFACE_TRY_COMPILE_WITH_ERROR) + message(SEND_ERROR "try_compile failed with imported target with error option.") +endif() diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/imported_consumer.cpp b/Tests/IncludeDirectories/SystemIncludeDirectories/imported_consumer.cpp new file mode 100644 index 0000000..1dbe819 --- /dev/null +++ b/Tests/IncludeDirectories/SystemIncludeDirectories/imported_consumer.cpp @@ -0,0 +1,7 @@ + +#include "systemlib.h" + +int main() +{ + return systemlib(); +} diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/systemlib_header_only/systemlib.h b/Tests/IncludeDirectories/SystemIncludeDirectories/systemlib_header_only/systemlib.h new file mode 100644 index 0000000..93622c4 --- /dev/null +++ b/Tests/IncludeDirectories/SystemIncludeDirectories/systemlib_header_only/systemlib.h @@ -0,0 +1,16 @@ + +#ifndef SYSTEMLIB_H +#define SYSTEMLIB_H + +int systemlib() +{ + return 0; +} + +int unusedFunc() +{ + int unused; + return systemlib(); +} + +#endif diff --git a/Tests/InterfaceLibrary/CMakeLists.txt b/Tests/InterfaceLibrary/CMakeLists.txt new file mode 100644 index 0000000..81b34e6 --- /dev/null +++ b/Tests/InterfaceLibrary/CMakeLists.txt @@ -0,0 +1,44 @@ + +cmake_minimum_required(VERSION 2.8) + +project(InterfaceLibrary) + +add_library(iface_nodepends INTERFACE) +target_compile_definitions(iface_nodepends INTERFACE IFACE_DEFINE) + +add_subdirectory(headerdir) + +add_executable(InterfaceLibrary definetestexe.cpp) +target_link_libraries(InterfaceLibrary iface_nodepends headeriface) + +add_subdirectory(libsdir) + +add_executable(sharedlibtestexe sharedlibtestexe.cpp) +target_link_libraries(sharedlibtestexe shared_iface imported::iface) + +add_library(broken EXCLUDE_FROM_ALL broken.cpp) + +add_library(iface_broken INTERFACE) +# This is not a dependency, so broken will not be built (and the error in +# it will not be hit) +target_link_libraries(iface_broken INTERFACE broken) + +add_library(iface_whitelist INTERFACE) +# The target property CUSTOM will never be evaluated on the INTERFACE library. +target_link_libraries(iface_whitelist INTERFACE $<$<BOOL:$<TARGET_PROPERTY:CUSTOM>>:irrelevant>) + +add_executable(exec_whitelist dummy.cpp) +target_link_libraries(exec_whitelist iface_whitelist) + +add_library(iface_imported INTERFACE IMPORTED) +set_property(TARGET iface_imported PROPERTY + INTERFACE_COMPILE_DEFINITIONS + $<$<CONFIG:SPECIAL>:SPECIAL_MODE> + $<$<CONFIG:Debug>:DEBUG_MODE> +) +set_property(TARGET iface_imported PROPERTY + MAP_IMPORTED_CONFIG_DEBUG SPECIAL +) + +add_executable(map_config map_config.cpp) +target_link_libraries(map_config iface_imported) diff --git a/Tests/InterfaceLibrary/broken.cpp b/Tests/InterfaceLibrary/broken.cpp new file mode 100644 index 0000000..1fd1041 --- /dev/null +++ b/Tests/InterfaceLibrary/broken.cpp @@ -0,0 +1,2 @@ + +#error Broken diff --git a/Tests/InterfaceLibrary/definetestexe.cpp b/Tests/InterfaceLibrary/definetestexe.cpp new file mode 100644 index 0000000..e7a10c1 --- /dev/null +++ b/Tests/InterfaceLibrary/definetestexe.cpp @@ -0,0 +1,21 @@ + +#ifndef IFACE_DEFINE +#error Expected IFACE_DEFINE +#endif + +#include "iface_header.h" + +#ifndef IFACE_HEADER_SRCDIR +#error Expected IFACE_HEADER_SRCDIR +#endif + +#include "iface_header_builddir.h" + +#ifndef IFACE_HEADER_BUILDDIR +#error Expected IFACE_HEADER_BUILDDIR +#endif + +int main(int,char**) +{ + return 0; +} diff --git a/Tests/InterfaceLibrary/dummy.cpp b/Tests/InterfaceLibrary/dummy.cpp new file mode 100644 index 0000000..341aaaf --- /dev/null +++ b/Tests/InterfaceLibrary/dummy.cpp @@ -0,0 +1,5 @@ + +int main(int, char **) +{ + return 0; +} diff --git a/Tests/InterfaceLibrary/headerdir/CMakeLists.txt b/Tests/InterfaceLibrary/headerdir/CMakeLists.txt new file mode 100644 index 0000000..98f521e --- /dev/null +++ b/Tests/InterfaceLibrary/headerdir/CMakeLists.txt @@ -0,0 +1,8 @@ + +set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) + +add_library(headeriface INTERFACE) + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/iface_header_builddir.h" + "#define IFACE_HEADER_BUILDDIR\n" +) diff --git a/Tests/InterfaceLibrary/headerdir/iface_header.h b/Tests/InterfaceLibrary/headerdir/iface_header.h new file mode 100644 index 0000000..82dd157 --- /dev/null +++ b/Tests/InterfaceLibrary/headerdir/iface_header.h @@ -0,0 +1 @@ +#define IFACE_HEADER_SRCDIR diff --git a/Tests/InterfaceLibrary/libsdir/CMakeLists.txt b/Tests/InterfaceLibrary/libsdir/CMakeLists.txt new file mode 100644 index 0000000..4e529df --- /dev/null +++ b/Tests/InterfaceLibrary/libsdir/CMakeLists.txt @@ -0,0 +1,28 @@ + +include(GenerateExportHeader) + +add_library(sharedlib SHARED sharedlib.cpp) +generate_export_header(sharedlib) + +add_library(shareddependlib SHARED shareddependlib.cpp) +generate_export_header(shareddependlib) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) + +target_link_libraries(sharedlib PUBLIC shareddependlib) + +target_include_directories(shareddependlib + PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/shareddependlib") +target_compile_definitions(shareddependlib + INTERFACE $<1:SHAREDDEPENDLIB_DEFINE>) + +target_include_directories(sharedlib + PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/sharedlib") +target_compile_definitions(shareddependlib + INTERFACE $<1:SHAREDLIB_DEFINE>) + +add_library(shared_iface INTERFACE) +target_link_libraries(shared_iface INTERFACE sharedlib) + +add_library(imported::iface INTERFACE IMPORTED GLOBAL) diff --git a/Tests/InterfaceLibrary/libsdir/shareddependlib.cpp b/Tests/InterfaceLibrary/libsdir/shareddependlib.cpp new file mode 100644 index 0000000..378ba81 --- /dev/null +++ b/Tests/InterfaceLibrary/libsdir/shareddependlib.cpp @@ -0,0 +1,7 @@ + +#include "shareddependlib.h" + +int SharedDependLibObject::foo() const +{ + return 0; +} diff --git a/Tests/InterfaceLibrary/libsdir/shareddependlib/shareddependlib.h b/Tests/InterfaceLibrary/libsdir/shareddependlib/shareddependlib.h new file mode 100644 index 0000000..ad9b484 --- /dev/null +++ b/Tests/InterfaceLibrary/libsdir/shareddependlib/shareddependlib.h @@ -0,0 +1,12 @@ + +#ifndef SHAREDDEPENDLIB_H +#define SHAREDDEPENDLIB_H + +#include "shareddependlib_export.h" + +struct SHAREDDEPENDLIB_EXPORT SharedDependLibObject +{ + int foo() const; +}; + +#endif diff --git a/Tests/InterfaceLibrary/libsdir/sharedlib.cpp b/Tests/InterfaceLibrary/libsdir/sharedlib.cpp new file mode 100644 index 0000000..c49ce90 --- /dev/null +++ b/Tests/InterfaceLibrary/libsdir/sharedlib.cpp @@ -0,0 +1,12 @@ + +#include "sharedlib.h" + +SharedDependLibObject SharedLibObject::object() const +{ + SharedDependLibObject sdlo; + return sdlo; +} +int SharedLibObject::foo() const +{ + return 0; +} diff --git a/Tests/InterfaceLibrary/libsdir/sharedlib/sharedlib.h b/Tests/InterfaceLibrary/libsdir/sharedlib/sharedlib.h new file mode 100644 index 0000000..5b3c7db --- /dev/null +++ b/Tests/InterfaceLibrary/libsdir/sharedlib/sharedlib.h @@ -0,0 +1,15 @@ + +#ifndef SHAREDLIB_H +#define SHAREDLIB_H + +#include "sharedlib_export.h" + +#include "shareddependlib.h" + +struct SHAREDLIB_EXPORT SharedLibObject +{ + SharedDependLibObject object() const; + int foo() const; +}; + +#endif diff --git a/Tests/InterfaceLibrary/map_config.cpp b/Tests/InterfaceLibrary/map_config.cpp new file mode 100644 index 0000000..81bb666 --- /dev/null +++ b/Tests/InterfaceLibrary/map_config.cpp @@ -0,0 +1,15 @@ + +#ifdef DEBUG_MODE +#ifndef SPECIAL_MODE +#error Special configuration should be mapped to debug configuration. +#endif +#else +#ifdef SPECIAL_MODE +#error Special configuration should not be enabled if not debug configuration +#endif +#endif + +int main(int,char**) +{ + return 0; +} diff --git a/Tests/InterfaceLibrary/sharedlibtestexe.cpp b/Tests/InterfaceLibrary/sharedlibtestexe.cpp new file mode 100644 index 0000000..c677f70 --- /dev/null +++ b/Tests/InterfaceLibrary/sharedlibtestexe.cpp @@ -0,0 +1,19 @@ + +#ifndef SHAREDLIB_DEFINE +#error Expected SHAREDLIB_DEFINE +#endif + +#ifndef SHAREDDEPENDLIB_DEFINE +#error Expected SHAREDDEPENDLIB_DEFINE +#endif + +#include "sharedlib.h" +#include "shareddependlib.h" + +int main(int,char**) +{ + SharedLibObject sl; + SharedDependLibObject sdl = sl.object(); + + return sdl.foo() + sl.foo(); +} diff --git a/Tests/LinkDirectory/CMakeLists.txt b/Tests/LinkDirectory/CMakeLists.txt index 7356b27..c60de84 100644 --- a/Tests/LinkDirectory/CMakeLists.txt +++ b/Tests/LinkDirectory/CMakeLists.txt @@ -11,13 +11,11 @@ endif() add_library(mylibA STATIC mylibA.c) set_property(TARGET mylibA PROPERTY ARCHIVE_OUTPUT_DIRECTORY "${LinkDirectory_BINARY_DIR}/External/lib") -get_property(mylibA TARGET mylibA PROPERTY LOCATION) # Build a library into our build tree relative to the subproject build tree. add_library(mylibB STATIC mylibB.c) set_property(TARGET mylibB PROPERTY ARCHIVE_OUTPUT_DIRECTORY "${LinkDirectory_BINARY_DIR}/lib") -get_property(mylibB TARGET mylibB PROPERTY LOCATION) # Create a custom target to drive the subproject build. include(ExternalProject) @@ -38,7 +36,7 @@ ExternalProject_Add_Step(ExternalTarget cleanup COMMAND ${CMAKE_COMMAND} -E remove_directory ${LinkDirectory_BINARY_DIR}/bin DEPENDEES download DEPENDERS configure - DEPENDS ${mylibA} ${mylibB} + DEPENDS mylibA mylibB "${LinkDirectory_BINARY_DIR}/External/CMakeLists.txt" "${LinkDirectory_BINARY_DIR}/External/myexe.c" ) diff --git a/Tests/MacRuntimePath/A/CMakeLists.txt b/Tests/MacRuntimePath/A/CMakeLists.txt index 5fc54f4..ade0a3c 100644 --- a/Tests/MacRuntimePath/A/CMakeLists.txt +++ b/Tests/MacRuntimePath/A/CMakeLists.txt @@ -10,13 +10,15 @@ add_library(shared2 SHARED shared.cpp shared.h) set_target_properties(shared2 PROPERTIES BUILD_WITH_INSTALL_RPATH 1 INSTALL_NAME_DIR "@rpath") +cmake_policy(SET CMP0042 NEW) + # a framework library add_library(framework SHARED framework.cpp framework.h) -set_target_properties(framework PROPERTIES MACOSX_RPATH 1 FRAMEWORK 1) +set_target_properties(framework PROPERTIES FRAMEWORK 1) # another framework add_library(framework2 SHARED framework2.cpp framework2.h) -set_target_properties(framework2 PROPERTIES MACOSX_RPATH 1 FRAMEWORK 1) +set_target_properties(framework2 PROPERTIES FRAMEWORK 1) # executable to test a shared library dependency with install rpaths add_executable(test1 test1.cpp) diff --git a/Tests/MacRuntimePath/CMakeLists.txt b/Tests/MacRuntimePath/CMakeLists.txt index 5e5b6c4..5c7b921 100644 --- a/Tests/MacRuntimePath/CMakeLists.txt +++ b/Tests/MacRuntimePath/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required (VERSION 2.8) project(MacRuntimePath) - +if(NOT DEFINED CMAKE_TEST_MAKEPROGRAM AND NOT CMAKE_GENERATOR MATCHES "Visual Studio") + set(CMAKE_TEST_MAKEPROGRAM "${CMAKE_MAKE_PROGRAM}") +endif() # Wipe out the install tree to make sure the exporter works. add_custom_command( @@ -38,7 +40,6 @@ add_custom_command( --build-target install --build-generator ${CMAKE_GENERATOR} --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" - --build-makeprogram ${CMAKE_MAKE_PROGRAM} --build-options -C${MacRuntimePath_BINARY_DIR}/InitialCache.cmake VERBATIM ) @@ -60,7 +61,6 @@ add_custom_command( --build-project MacRuntimePath_B --build-generator ${CMAKE_GENERATOR} --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" - --build-makeprogram ${CMAKE_MAKE_PROGRAM} --build-options -C${MacRuntimePath_BINARY_DIR}/InitialCache.cmake VERBATIM ) diff --git a/Tests/MacRuntimePath/InitialCache.cmake.in b/Tests/MacRuntimePath/InitialCache.cmake.in index be15eb3..3dc9041 100644 --- a/Tests/MacRuntimePath/InitialCache.cmake.in +++ b/Tests/MacRuntimePath/InitialCache.cmake.in @@ -1,3 +1,4 @@ +set(CMAKE_MAKE_PROGRAM "@CMAKE_TEST_MAKEPROGRAM@" CACHE FILEPATH "Make Program") set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@" CACHE STRING "C Compiler") set(CMAKE_C_FLAGS "@CMAKE_C_FLAGS@" CACHE STRING "C Flags") set(CMAKE_C_FLAGS_DEBUG "@CMAKE_C_FLAGS_DEBUG@" CACHE STRING "C Flags") diff --git a/Tests/MakeClean/CMakeLists.txt b/Tests/MakeClean/CMakeLists.txt index 13348a2..8ac624a 100644 --- a/Tests/MakeClean/CMakeLists.txt +++ b/Tests/MakeClean/CMakeLists.txt @@ -37,21 +37,14 @@ foreach(f ${TOCLEAN_FILES}) set(CHECK_FILES "${CHECK_FILES} \"${f}\",\n") endforeach() configure_file(${MakeClean_SOURCE_DIR}/check_clean.c.in - ${MakeClean_BINARY_DIR}/check_clean.c @ONLY IMMEDIATE) + ${MakeClean_BINARY_DIR}/check_clean.c @ONLY) add_executable(check_clean ${MakeClean_BINARY_DIR}/check_clean.c) # After the executable builds, clean the files. add_custom_command( TARGET check_clean POST_BUILD - COMMAND ${CMAKE_CTEST_COMMAND} - ARGS --build-and-test - ${MakeClean_SOURCE_DIR}/ToClean - ${MakeClean_BINARY_DIR}/ToClean - --build-generator ${CMAKE_GENERATOR} - --build-project ToClean - --build-makeprogram ${CMAKE_MAKE_PROGRAM} - --build-noclean - --build-target clean + COMMAND ${CMAKE_COMMAND} --build ${MakeClean_BINARY_DIR}/ToClean + --target clean COMMENT "Clean the ToClean Project" ) diff --git a/Tests/MakeClean/ToClean/CMakeLists.txt b/Tests/MakeClean/ToClean/CMakeLists.txt index 28569dd..d0e24ce 100644 --- a/Tests/MakeClean/ToClean/CMakeLists.txt +++ b/Tests/MakeClean/ToClean/CMakeLists.txt @@ -5,7 +5,6 @@ project(ToClean) add_executable(toclean toclean.cxx) # List some build-time-generated files. -get_target_property(TOCLEAN_FILES toclean LOCATION) set(TOCLEAN_FILES ${TOCLEAN_FILES} "${ToClean_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/toclean.dir/toclean.cxx${CMAKE_CXX_OUTPUT_EXTENSION}") @@ -26,6 +25,18 @@ add_custom_command(OUTPUT ${ToClean_BINARY_DIR}/generated.txt add_custom_target(generate ALL DEPENDS ${ToClean_BINARY_DIR}/generated.txt) set(TOCLEAN_FILES ${TOCLEAN_FILES} "${ToClean_BINARY_DIR}/generated.txt") +# Create a custom command whose output should be cleaned, but whose name +# is not known until generate-time +set(copied_exe "$<TARGET_FILE_DIR:toclean>/toclean_copy${CMAKE_EXECUTABLE_SUFFIX}") +add_custom_command(TARGET toclean POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy $<TARGET_FILE:toclean> + ${copied_exe} + ) +set_property(DIRECTORY APPEND PROPERTY + ADDITIONAL_MAKE_CLEAN_FILES ${copied_exe}) +list(APPEND TOCLEAN_FILES "${ToClean_BINARY_DIR}/toclean_copy${CMAKE_EXECUTABLE_SUFFIX}") + # Configure a file listing these build-time-generated files. configure_file(${ToClean_SOURCE_DIR}/ToCleanFiles.cmake.in - ${ToClean_BINARY_DIR}/ToCleanFiles.cmake @ONLY IMMEDIATE) + ${ToClean_BINARY_DIR}/ToCleanFiles.cmake @ONLY) diff --git a/Tests/MissingInstall/CMakeLists.txt b/Tests/MissingInstall/CMakeLists.txt new file mode 100644 index 0000000..91624f7 --- /dev/null +++ b/Tests/MissingInstall/CMakeLists.txt @@ -0,0 +1,25 @@ +cmake_minimum_required (VERSION 2.8.12) +project(TestMissingInstall) + +set(CMAKE_SKIP_INSTALL_RULES ON) + +# Skip the dependency that causes a build when installing. This +# avoids infinite loops when the post-build rule below installs. +set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY 1) +set(CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY 1) + +if(CMAKE_CONFIGURATION_TYPES) + set(MULTI_CONFIG ON) +else() + set(MULTI_CONFIG OFF) +endif() + +add_executable(mybin mybin.cpp) +install(TARGETS mybin RUNTIME DESTINATION bin) + +add_custom_command(TARGET mybin + POST_BUILD + COMMAND ${CMAKE_COMMAND} "-DMULTI_CONFIG=${MULTI_CONFIG}" + -P ${CMAKE_CURRENT_SOURCE_DIR}/ExpectInstallFail.cmake + COMMENT "Install Project" +) diff --git a/Tests/MissingInstall/ExpectInstallFail.cmake b/Tests/MissingInstall/ExpectInstallFail.cmake new file mode 100644 index 0000000..3d677bf --- /dev/null +++ b/Tests/MissingInstall/ExpectInstallFail.cmake @@ -0,0 +1,18 @@ +if(MULTI_CONFIG) + set(SI_CONFIG --config $<CONFIGURATION>) +else() + set(SI_CONFIG) +endif() + +execute_process( + COMMAND ${CMAKE_COMMAND} + --build . + --target install ${SI_CONFIG} + RESULT_VARIABLE RESULT + OUTPUT_VARIABLE OUTPUT + ERROR_VARIABLE ERROR +) + +if(RESULT EQUAL 0) + message(FATAL_ERROR "install should have failed") +endif() diff --git a/Tests/MissingInstall/mybin.cpp b/Tests/MissingInstall/mybin.cpp new file mode 100644 index 0000000..237c8ce --- /dev/null +++ b/Tests/MissingInstall/mybin.cpp @@ -0,0 +1 @@ +int main() {} diff --git a/Tests/Module/CheckTypeSize/CMakeLists.txt b/Tests/Module/CheckTypeSize/CMakeLists.txt index abe617a..16989fe2 100644 --- a/Tests/Module/CheckTypeSize/CMakeLists.txt +++ b/Tests/Module/CheckTypeSize/CMakeLists.txt @@ -1,6 +1,7 @@ cmake_minimum_required(VERSION 2.8.1 FATAL_ERROR) -project(CheckTypeSize C) +project(CheckTypeSize) +# Check C types include(CheckTypeSize) check_type_size("void*" SIZEOF_DATA_PTR) check_type_size(char SIZEOF_CHAR) @@ -18,7 +19,19 @@ check_type_size("((struct somestruct*)0)->someint" SIZEOF_STRUCTMEMBER_INT) check_type_size("((struct somestruct*)0)->someptr" SIZEOF_STRUCTMEMBER_PTR) check_type_size("((struct somestruct*)0)->somechar" SIZEOF_STRUCTMEMBER_CHAR) +# Check CXX types +check_type_size(bool SIZEOF_BOOL LANGUAGE CXX) + +set(CMAKE_EXTRA_INCLUDE_FILES someclass.hxx) +check_type_size("((ns::someclass*)0)->someint" SIZEOF_NS_CLASSMEMBER_INT LANGUAGE CXX) +check_type_size("((ns::someclass*)0)->someptr" SIZEOF_NS_CLASSMEMBER_PTR LANGUAGE CXX) +check_type_size("((ns::someclass*)0)->somechar" SIZEOF_NS_CLASSMEMBER_CHAR LANGUAGE CXX) +check_type_size("((ns::someclass*)0)->somebool" SIZEOF_NS_CLASSMEMBER_BOOL LANGUAGE CXX) + configure_file(config.h.in config.h) +configure_file(config.hxx.in config.hxx) + include_directories("${CheckTypeSize_BINARY_DIR}") add_executable(CheckTypeSize CheckTypeSize.c) +add_executable(CheckTypeSizeCXX CheckTypeSize.cxx) diff --git a/Tests/Module/CheckTypeSize/CheckTypeSize.cxx b/Tests/Module/CheckTypeSize/CheckTypeSize.cxx new file mode 100644 index 0000000..b5692cd --- /dev/null +++ b/Tests/Module/CheckTypeSize/CheckTypeSize.cxx @@ -0,0 +1,172 @@ +#include "config.h" +#include "config.hxx" +#include "someclass.hxx" + +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#ifdef HAVE_STDINT_H +# include <stdint.h> +#endif +#ifdef HAVE_STDDEF_H +# include <stddef.h> +#endif + +#include <stdio.h> + +#define CHECK(t,m) do { \ + if(sizeof(t) != m) \ + { \ + printf(#m ": expected %d, got %d (line %d)\n", \ + (int)sizeof(t), (int)m, __LINE__); \ + result = 1; \ + } \ + } while(0) + +#define NODEF(m) do { \ + printf(#m": not defined (line %d)\n", __LINE__); \ + result = 1; \ + } while(0) + +int main() +{ + int result = 0; + ns::someclass y; + + /* void* */ +#if !defined(HAVE_SIZEOF_DATA_PTR) + NODEF(HAVE_SIZEOF_DATA_PTR); +#endif +#if defined(SIZEOF_DATA_PTR) + CHECK(void*, SIZEOF_DATA_PTR); +#else + NODEF(SIZEOF_DATA_PTR); +#endif + + /* char */ +#if !defined(HAVE_SIZEOF_CHAR) + NODEF(HAVE_SIZEOF_CHAR); +#endif +#if defined(SIZEOF_CHAR) + CHECK(char, SIZEOF_CHAR); +#else + NODEF(SIZEOF_CHAR); +#endif + + /* short */ +#if !defined(HAVE_SIZEOF_SHORT) + NODEF(HAVE_SIZEOF_SHORT); +#endif +#if defined(SIZEOF_SHORT) + CHECK(short, SIZEOF_SHORT); +#else + NODEF(SIZEOF_SHORT); +#endif + + /* int */ +#if !defined(HAVE_SIZEOF_INT) + NODEF(HAVE_SIZEOF_INT); +#endif +#if defined(SIZEOF_INT) + CHECK(int, SIZEOF_INT); +#else + NODEF(SIZEOF_INT); +#endif + + /* long */ +#if !defined(HAVE_SIZEOF_LONG) + NODEF(HAVE_SIZEOF_LONG); +#endif +#if defined(SIZEOF_LONG) + CHECK(long, SIZEOF_LONG); +#else + NODEF(SIZEOF_LONG); +#endif + + /* long long */ +#if defined(SIZEOF_LONG_LONG) + CHECK(long long, SIZEOF_LONG_LONG); +# if !defined(HAVE_SIZEOF_LONG_LONG) + NODEF(HAVE_SIZEOF_LONG_LONG); +# endif +#endif + + /* __int64 */ +#if defined(SIZEOF___INT64) + CHECK(__int64, SIZEOF___INT64); +# if !defined(HAVE_SIZEOF___INT64) + NODEF(HAVE_SIZEOF___INT64); +# endif +#elif defined(HAVE_SIZEOF___INT64) + NODEF(SIZEOF___INT64); +#endif + + /* size_t */ +#if !defined(HAVE_SIZEOF_SIZE_T) + NODEF(HAVE_SIZEOF_SIZE_T); +#endif +#if defined(SIZEOF_SIZE_T) + CHECK(size_t, SIZEOF_SIZE_T); +#else + NODEF(SIZEOF_SIZE_T); +#endif + + /* ssize_t */ +#if defined(SIZEOF_SSIZE_T) + CHECK(ssize_t, SIZEOF_SSIZE_T); +# if !defined(HAVE_SIZEOF_SSIZE_T) + NODEF(HAVE_SIZEOF_SSIZE_T); +# endif +#elif defined(HAVE_SIZEOF_SSIZE_T) + NODEF(SIZEOF_SSIZE_T); +#endif + + /* ns::someclass::someint */ +#if defined(SIZEOF_NS_CLASSMEMBER_INT) + CHECK(y.someint, SIZEOF_NS_CLASSMEMBER_INT); + CHECK(y.someint, SIZEOF_INT); +# if !defined(HAVE_SIZEOF_NS_CLASSMEMBER_INT) + NODEF(HAVE_SIZEOF_STRUCTMEMBER_INT); +# endif +#elif defined(HAVE_SIZEOF_STRUCTMEMBER_INT) + NODEF(SIZEOF_STRUCTMEMBER_INT); +#endif + + /* ns::someclass::someptr */ +#if defined(SIZEOF_NS_CLASSMEMBER_PTR) + CHECK(y.someptr, SIZEOF_NS_CLASSMEMBER_PTR); + CHECK(y.someptr, SIZEOF_DATA_PTR); +# if !defined(HAVE_SIZEOF_NS_CLASSMEMBER_PTR) + NODEF(HAVE_SIZEOF_NS_CLASSMEMBER_PTR); +# endif +#elif defined(HAVE_SIZEOF_NS_CLASSMEMBER_PTR) + NODEF(SIZEOF_NS_CLASSMEMBER_PTR); +#endif + + /* ns::someclass::somechar */ +#if defined(SIZEOF_NS_CLASSMEMBER_CHAR) + CHECK(y.somechar, SIZEOF_NS_CLASSMEMBER_CHAR); + CHECK(y.somechar, SIZEOF_CHAR); +# if !defined(HAVE_SIZEOF_NS_CLASSMEMBER_CHAR) + NODEF(HAVE_SIZEOF_NS_CLASSMEMBER_CHAR); +# endif +#elif defined(HAVE_SIZEOF_NS_CLASSMEMBER_CHAR) + NODEF(SIZEOF_NS_CLASSMEMBER_CHAR); +#endif + + /* ns::someclass::somebool */ +#if defined(SIZEOF_NS_CLASSMEMBER_BOOL) + CHECK(y.somechar, SIZEOF_NS_CLASSMEMBER_BOOL); + CHECK(y.somechar, SIZEOF_BOOL); +# if !defined(HAVE_SIZEOF_NS_CLASSMEMBER_BOOL) + NODEF(HAVE_SIZEOF_NS_CLASSMEMBER_BOOL); +# endif +#elif defined(HAVE_SIZEOF_NS_CLASSMEMBER_BOOL) + NODEF(SIZEOF_NS_CLASSMEMBER_BOOL); +#endif + + /* to avoid possible warnings about unused or write-only variable */ + y.someint = result; + + return y.someint; +} diff --git a/Tests/Module/CheckTypeSize/config.hxx.in b/Tests/Module/CheckTypeSize/config.hxx.in new file mode 100644 index 0000000..8c66ade --- /dev/null +++ b/Tests/Module/CheckTypeSize/config.hxx.in @@ -0,0 +1,23 @@ +#cmakedefine HAVE_SYS_TYPES_H +#cmakedefine HAVE_STDINT_H +#cmakedefine HAVE_STDDEF_H + +/* bool */ +#cmakedefine HAVE_SIZEOF_BOOL +@SIZEOF_BOOL_CODE@ + +/* struct ns::somestruct::someint */ +#cmakedefine HAVE_SIZEOF_NS_STRUCTMEMBER_INT +@SIZEOF_NS_STRUCTMEMBER_INT_CODE@ + +/* struct ns::somestruct::someptr */ +#cmakedefine HAVE_SIZEOF_NS_STRUCTMEMBER_PTR +@SIZEOF_NS_STRUCTMEMBER_PTR_CODE@ + +/* struct ns::somestruct::somechar */ +#cmakedefine HAVE_SIZEOF_NS_STRUCTMEMBER_CHAR +@SIZEOF_NS_STRUCTMEMBER_CHAR_CODE@ + +/* struct ns::somestruct::somebool */ +#cmakedefine HAVE_SIZEOF_NS_STRUCTMEMBER_BOOL +@SIZEOF_NS_STRUCTMEMBER_BOOL_CODE@ diff --git a/Tests/Module/CheckTypeSize/someclass.hxx b/Tests/Module/CheckTypeSize/someclass.hxx new file mode 100644 index 0000000..76c07ec --- /dev/null +++ b/Tests/Module/CheckTypeSize/someclass.hxx @@ -0,0 +1,14 @@ +#ifndef _CMAKE_SOMECLASS_HXX +#define _CMAKE_SOMECLASS_HXX + +namespace ns { +class someclass { +public: + int someint; + void *someptr; + char somechar; + bool somebool; +}; +} + +#endif diff --git a/Tests/Module/ExternalData/CMakeLists.txt b/Tests/Module/ExternalData/CMakeLists.txt index 8312dca..5a6f3d5 100644 --- a/Tests/Module/ExternalData/CMakeLists.txt +++ b/Tests/Module/ExternalData/CMakeLists.txt @@ -42,3 +42,4 @@ ExternalData_Add_Target(Data1) add_subdirectory(Data2) add_subdirectory(Data3) +add_subdirectory(Data4) diff --git a/Tests/Module/ExternalData/Data4/CMakeLists.txt b/Tests/Module/ExternalData/Data4/CMakeLists.txt new file mode 100644 index 0000000..ac977fb --- /dev/null +++ b/Tests/Module/ExternalData/Data4/CMakeLists.txt @@ -0,0 +1,15 @@ +set(Store0 ${CMAKE_BINARY_DIR}/ExternalData/Other) +set(Store1 ${CMAKE_BINARY_DIR}/ExternalData/Objects) +set(ExternalData_OBJECT_STORES ${Store0} ${Store1}) +unset(ExternalData_URL_TEMPLATES) # All objects already in stores! +ExternalData_Add_Test(Data4 + NAME Data4Check + COMMAND ${CMAKE_COMMAND} + -D Data=DATA{Data.dat} + -D Other=DATA{Other.dat} + -D Store0=${Store0} + -D Store1=${Store1} + -P ${CMAKE_CURRENT_SOURCE_DIR}/Data4Check.cmake + ) +ExternalData_Add_Target(Data4) +add_dependencies(Data4 Data3) diff --git a/Tests/Module/ExternalData/Data4/Data.dat.md5 b/Tests/Module/ExternalData/Data4/Data.dat.md5 new file mode 100644 index 0000000..70e39bd --- /dev/null +++ b/Tests/Module/ExternalData/Data4/Data.dat.md5 @@ -0,0 +1 @@ +8c018830e3efa5caf3c7415028335a57 diff --git a/Tests/Module/ExternalData/Data4/Data4Check.cmake b/Tests/Module/ExternalData/Data4/Data4Check.cmake new file mode 100644 index 0000000..e614cc4 --- /dev/null +++ b/Tests/Module/ExternalData/Data4/Data4Check.cmake @@ -0,0 +1,26 @@ +if(NOT EXISTS "${Data}") + message(SEND_ERROR "Input file:\n ${Data}\ndoes not exist!") +endif() +if(NOT EXISTS "${Other}") + message(SEND_ERROR "Input file:\n ${Other}\ndoes not exist!") +endif() +# Verify that the 'Data' object was found in the second store location left +# from Data1 target downloads and that the 'Other' object was found in the +# first store location left from Data3 target downloads. Neither object +# should exist in the opposite store. +foreach(should_exist + "${Store0}/MD5/aaad162b85f60d1eb57ca71a23e8efd7" + "${Store1}/MD5/8c018830e3efa5caf3c7415028335a57" + ) + if(NOT EXISTS ${should_exist}) + message(SEND_ERROR "Store file:\n ${should_exist}\nshould exist!") + endif() +endforeach() +foreach(should_not_exist + "${Store0}/MD5/8c018830e3efa5caf3c7415028335a57" + "${Store1}/MD5/aaad162b85f60d1eb57ca71a23e8efd7" + ) + if(EXISTS ${should_not_exist}) + message(SEND_ERROR "Store file:\n ${should_not_exist}\nshould not exist!") + endif() +endforeach() diff --git a/Tests/Module/ExternalData/Data4/Other.dat.md5 b/Tests/Module/ExternalData/Data4/Other.dat.md5 new file mode 100644 index 0000000..5312faa --- /dev/null +++ b/Tests/Module/ExternalData/Data4/Other.dat.md5 @@ -0,0 +1 @@ +aaad162b85f60d1eb57ca71a23e8efd7 diff --git a/Tests/Module/GenerateExportHeader/CMakeLists.txt b/Tests/Module/GenerateExportHeader/CMakeLists.txt index 09f1881..bf867a9 100644 --- a/Tests/Module/GenerateExportHeader/CMakeLists.txt +++ b/Tests/Module/GenerateExportHeader/CMakeLists.txt @@ -55,93 +55,9 @@ else() endif() endif() -set(DEPS - libshared - libstatic - lib_shared_and_static -) - -foreach(DEP ${DEPS}) - try_compile(Result ${CMAKE_CURRENT_BINARY_DIR}/${DEP}_build - ${CMAKE_CURRENT_SOURCE_DIR}/${DEP} - ${DEP} - OUTPUT_VARIABLE Out - ) - if (NOT Result) - message("OUTPUT: ${Out}") - endif() -endforeach() - -# The _do_build macro is called from a child scope, where -# the current source and binary dir are different. Save them here -# for use in the macro. -set(TEST_TOP_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) -set(TEST_TOP_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) - - -# We seem to get race conditions is writing this stuff to the same file at least on MinGW -# So to write to separate source and build directories, we use a count to differentiate. -set (COUNT 0) -macro(_do_build Include Library LibrarySource Source) - - math(EXPR COUNT "${COUNT} + 1" ) - - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test${COUNT}/src.cpp" "#include \"${Include}\"\n" - "int main() { ${Source}; }\n" - ) - - if ("${Library}" STREQUAL "static_variant") - set(CONDITIONAL_STATIC_DEFINE "add_definitions(-DLIBSHARED_AND_STATIC_STATIC_DEFINE)\n") - endif() - - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test${COUNT}/CMakeLists.txt" - "cmake_minimum_required(VERSION 2.8)\n" - - "project(compiletest)\n" - - "set(CMAKE_INCLUDE_CURRENT_DIR ON)\n" - - "set(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"\${CMAKE_CURRENT_BINARY_DIR}\")\n" - - "include(GenerateExportHeader)\n" - - "add_compiler_export_flags()\n" - - "if(NOT \"${ERROR_FLAG}\" STREQUAL \"\")\n" - " add_definitions(${ERROR_FLAG})\n" - "endif()\n" - - "include(\"${TEST_TOP_BINARY_DIR}/${LibrarySource}_build/Targets.cmake\")\n" - - "include_directories(\"${TEST_TOP_SOURCE_DIR}/${LibrarySource}\"\n" - " \"${TEST_TOP_BINARY_DIR}/${LibrarySource}_build\")\n" - - "${CONDITIONAL_STATIC_DEFINE}" - - "add_executable(compiletest src.cpp)\n" - "target_link_libraries(compiletest ${Library})\n" - ) - - try_compile(Result ${CMAKE_CURRENT_BINARY_DIR}/fail${COUNT} - ${CMAKE_CURRENT_BINARY_DIR}/test${COUNT} - compiletest - OUTPUT_VARIABLE Out - ) -endmacro() - -macro(build_fail Include Library LibrarySource Source Message) - _do_build(${Include} ${Library} ${LibrarySource} "${Source}") - test_fail(Result ${Message}) -endmacro() - -macro(build_pass Include Library LibrarySource Source Message) - _do_build(${Include} ${Library} ${LibrarySource} "${Source}") - test_pass(Result ${Message}) -endmacro() - include(GenerateExportHeader) -add_subdirectory(visibility_preset) +add_subdirectory(lib_shared_and_static) add_compiler_export_flags() @@ -159,23 +75,17 @@ macro(macro_add_test_library name) ${${name}_BINARY_DIR} # For the export header. ) list(APPEND link_libraries ${name}) - add_subdirectory(${name}test) endmacro() macro_add_test_library(libshared) macro_add_test_library(libstatic) -add_subdirectory(lib_shared_and_static) -add_subdirectory(lib_shared_and_statictest) -add_subdirectory(override_symbol) add_subdirectory(nodeprecated) -add_subdirectory(prefix) if(NOT BORLAND) add_subdirectory(c_identifier) endif() if (CMAKE_COMPILER_IS_GNUCXX OR (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)) - # We deliberately call deprecated methods, and test for that elsewhere. # No need to clutter the test output with warnings. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations") endif() @@ -187,3 +97,24 @@ endif() add_executable(GenerateExportHeader exportheader_test.cpp) target_link_libraries(GenerateExportHeader ${link_libraries}) +if (WIN32) + if(MSVC AND COMPILER_HAS_DEPRECATED) + set(_platform Win32) + elseif(MINGW AND COMPILER_HAS_DEPRECATED) + set(_platform MinGW) + else() + set(_platform WinEmpty) + endif() +elseif(COMPILER_HAS_HIDDEN_VISIBILITY AND USE_COMPILER_HIDDEN_VISIBILITY) + set(_platform UNIX) +elseif(COMPILER_HAS_DEPRECATED) + set(_platform UNIX_DeprecatedOnly) +else() + set(_platform Empty) +endif() +message("#### Testing reference: ${_platform}") +target_compile_definitions(GenerateExportHeader + PRIVATE + "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 55c3c1a..146374a 100644 --- a/Tests/Module/GenerateExportHeader/exportheader_test.cpp +++ b/Tests/Module/GenerateExportHeader/exportheader_test.cpp @@ -11,6 +11,52 @@ #define DOES_NOT_BUILD(function) function #endif +#include <fstream> +#include <iostream> +#include <stdlib.h> +#include <string> + +void compare(const char* refName, const char* testName) +{ + std::ifstream ref; + ref.open(refName); + if (!ref.is_open()) + { + std::cout << "Could not open \"" << refName << "\"." << std::endl; + exit(1); + } + std::ifstream test; + test.open(testName); + if (!test.is_open()) + { + std::cout << "Could not open \"" << testName << "\"." << std::endl; + exit(1); + } + + while (!ref.eof() && !test.eof()) + { + std::string refLine; + std::string testLine; + std::getline(ref, refLine); + std::getline(test, testLine); + if (testLine.size() && testLine[testLine.size()-1] == ' ') + { + testLine = testLine.substr(0, testLine.size() - 1); + } + if (refLine != testLine) + { + std::cout << "Ref and test are not the same:\n Ref: \"" + << refLine << "\"\n Test: \"" << testLine << "\"\n"; + exit(1); + } + } + if (!ref.eof() || !test.eof()) + { + std::cout << "Ref and test have differing numbers of lines."; + exit(1); + } +} + int main() { { @@ -78,5 +124,13 @@ 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"); + return 0; } diff --git a/Tests/Module/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt b/Tests/Module/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt index be0387f..c1be125 100644 --- a/Tests/Module/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt +++ b/Tests/Module/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt @@ -5,7 +5,15 @@ project(lib_shared_and_static) include(GenerateExportHeader) -add_compiler_export_flags() +set(CMAKE_CXX_VISIBILITY_PRESET hidden) +set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) + +if (CMAKE_CXX_FLAGS MATCHES "-fvisibility=hidden") + message(SEND_ERROR "Do not use add_compiler_export_flags before adding this directory") +endif() +if (CMAKE_CXX_FLAGS MATCHES "-fvisibility-inlines-hidden") + message(SEND_ERROR "Do not use add_compiler_export_flags before adding this directory") +endif() set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -14,9 +22,13 @@ set(lib_SRCS ) add_library(shared_variant SHARED ${lib_SRCS}) +set_target_properties(shared_variant PROPERTIES DEFINE_SYMBOL SHARED_VARIANT_MAKEDLL) add_library(static_variant ${lib_SRCS}) -generate_export_header(shared_variant BASE_NAME libshared_and_static) +generate_export_header(shared_variant + BASE_NAME libshared_and_static + PREFIX_NAME MYPREFIX_ +) set_target_properties(static_variant PROPERTIES COMPILE_FLAGS -DLIBSHARED_AND_STATIC_STATIC_DEFINE) diff --git a/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h b/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h index 049bfe9..5ad77f4 100644 --- a/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h +++ b/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h @@ -4,51 +4,51 @@ #include "libshared_and_static_export.h" -class LIBSHARED_AND_STATIC_EXPORT LibsharedAndStatic { +class MYPREFIX_LIBSHARED_AND_STATIC_EXPORT LibsharedAndStatic { public: int libshared_and_static() const; int libshared_and_static_exported() const; - int LIBSHARED_AND_STATIC_DEPRECATED libshared_and_static_deprecated() const; + int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED libshared_and_static_deprecated() const; int libshared_and_static_not_exported() const; - int LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded() const; + int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded() const; }; class LibsharedAndStaticNotExported { public: int libshared_and_static() const; - int LIBSHARED_AND_STATIC_EXPORT libshared_and_static_exported() const; + int MYPREFIX_LIBSHARED_AND_STATIC_EXPORT libshared_and_static_exported() const; - int LIBSHARED_AND_STATIC_DEPRECATED libshared_and_static_deprecated() const; + int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED libshared_and_static_deprecated() const; int libshared_and_static_not_exported() const; - int LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded() const; + int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded() const; }; -class LIBSHARED_AND_STATIC_NO_EXPORT LibsharedAndStaticExcluded { +class MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT LibsharedAndStaticExcluded { public: int libshared_and_static() const; - int LIBSHARED_AND_STATIC_EXPORT libshared_and_static_exported() const; + int MYPREFIX_LIBSHARED_AND_STATIC_EXPORT libshared_and_static_exported() const; - int LIBSHARED_AND_STATIC_DEPRECATED libshared_and_static_deprecated() const; + int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED libshared_and_static_deprecated() const; int libshared_and_static_not_exported() const; - int LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded() const; + int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded() const; }; -LIBSHARED_AND_STATIC_EXPORT int libshared_and_static_exported(); +MYPREFIX_LIBSHARED_AND_STATIC_EXPORT int libshared_and_static_exported(); -LIBSHARED_AND_STATIC_DEPRECATED_EXPORT int libshared_and_static_deprecated(); +MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED_EXPORT int libshared_and_static_deprecated(); int libshared_and_static_not_exported(); -int LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded(); +int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded(); #endif diff --git a/Tests/Module/GenerateExportHeader/lib_shared_and_statictest/CMakeLists.txt b/Tests/Module/GenerateExportHeader/lib_shared_and_statictest/CMakeLists.txt deleted file mode 100644 index 207534d..0000000 --- a/Tests/Module/GenerateExportHeader/lib_shared_and_statictest/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ - -macro(shared_variant_build_pass Source Message) - build_pass("libshared_and_static.h" "shared_variant" "lib_shared_and_static" "${Source}" ${Message}) -endmacro() - -macro(shared_variant_build_fail Source Message) - build_fail("libshared_and_static.h" "shared_variant" "lib_shared_and_static" "${Source}" ${Message}) -endmacro() - -macro(static_variant_build_pass Source Message) - build_pass("libshared_and_static.h" "static_variant" "lib_shared_and_static" "${Source}" ${Message}) -endmacro() - -macro(static_variant_build_fail Source Message) - build_fail("libshared_and_static.h" "static_variant" "lib_shared_and_static" "${Source}" ${Message}) -endmacro() - -static_variant_build_pass("return libshared_and_static_exported();" "Failed to build static variant") -shared_variant_build_pass("return libshared_and_static_exported();" "Failed to build shared variant") -# if (COMPILER_HAS_DEPRECATED) -# shared_variant_build_fail("return libshared_and_static_deprecated();" "Built shared deprecated variant") -# static_variant_build_fail("return libshared_and_static_deprecated();" "Built static deprecated variant") -# else() -# shared_variant_build_pass("return libshared_and_static_deprecated();" "Built shared deprecated variant") -# static_variant_build_pass("return libshared_and_static_deprecated();" "Built static deprecated variant") -# endif() -static_variant_build_pass("return libshared_and_static_not_exported();" "Failed to build static not exported variant") - -if (WIN32 OR COMPILER_HAS_HIDDEN_VISIBILITY) - shared_variant_build_fail("return libshared_and_static_not_exported();" "Built shared not exported variant") -else() - shared_variant_build_pass("return libshared_and_static_not_exported();" "Built shared not exported variant") -endif() diff --git a/Tests/Module/GenerateExportHeader/libsharedtest/CMakeLists.txt b/Tests/Module/GenerateExportHeader/libsharedtest/CMakeLists.txt deleted file mode 100644 index 2a97d8f..0000000 --- a/Tests/Module/GenerateExportHeader/libsharedtest/CMakeLists.txt +++ /dev/null @@ -1,45 +0,0 @@ - -macro(shared_build_pass Source Message) - build_pass("libshared.h" "libshared" "libshared" "${Source}" ${Message}) -endmacro() - -macro(shared_build_fail Source Message) - build_fail("libshared.h" "libshared" "libshared" "${Source}" ${Message}) -endmacro() - -shared_build_pass("Libshared l; return l.libshared_exported();" "Failed to build exported") -shared_build_pass("return libshared_exported();" "Failed to build exported function.") - -# if (COMPILER_HAS_DEPRECATED) -# shared_build_fail("Libshared l; return l.libshared_deprecated();" "Built use of deprecated class method. This should not be possible.") -# else() -# shared_build_pass("Libshared l; return l.libshared_deprecated();" "Built use of deprecated class method. This should not be possible.") -# endif() -if (COMPILER_HAS_HIDDEN_VISIBILITY) - shared_build_fail("Libshared l; return l.libshared_excluded();" "Built use of excluded class method. This should not be possible.") -else() - # There is no MSVC equivalent to hiding symbols. - shared_build_pass("Libshared l; return l.libshared_excluded();" "Built use of excluded class method. This is possible on MSVC.") -endif() - -if (WIN32 OR COMPILER_HAS_HIDDEN_VISIBILITY) - shared_build_fail("LibsharedNotExported l; return l.libshared();" "Built use of not-exported class method. This should not be possible.") - shared_build_fail("LibsharedNotExported l; return l.libshared_not_exported();" "Built use of not-exported class method. This should not be possible.") - shared_build_fail("LibsharedNotExported l; return l.libshared_excluded();" "Built use of not-exported class method. This should not be possible.") - shared_build_fail("LibsharedExcluded l; return l.libshared();" "Built use of excluded class method. This should not be possible.") - shared_build_fail("LibsharedExcluded l; return l.libshared_not_exported();" "Built use of excluded class method. This should not be possible.") - shared_build_fail("LibsharedExcluded l; return l.libshared_excluded();" "Built use of excluded class method. This should not be possible.") - - shared_build_fail("return libshared_excluded();" "Built use of excluded function. This should not be possible.") - shared_build_fail("return libshared_not_exported();" "Built use of not-exported function. This should not be possible.") -else() - shared_build_pass("LibsharedNotExported l; return l.libshared();" "Built use of not-exported class method.") - shared_build_pass("LibsharedNotExported l; return l.libshared_not_exported();" "Built use of not-exported class method.") - shared_build_pass("LibsharedNotExported l; return l.libshared_excluded();" "Built use of not-exported class method.") - shared_build_pass("LibsharedExcluded l; return l.libshared();" "Built use of excluded class method.") - shared_build_pass("LibsharedExcluded l; return l.libshared_not_exported();" "Built use of excluded class method.") - shared_build_pass("LibsharedExcluded l; return l.libshared_excluded();" "Built use of excluded class method.") - - shared_build_pass("return libshared_excluded();" "Built use of excluded function.") - shared_build_pass("return libshared_not_exported();" "Built use of not-exported function.") -endif() diff --git a/Tests/Module/GenerateExportHeader/libstatictest/CMakeLists.txt b/Tests/Module/GenerateExportHeader/libstatictest/CMakeLists.txt deleted file mode 100644 index eb6bb87..0000000 --- a/Tests/Module/GenerateExportHeader/libstatictest/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ - -macro(static_build_pass Source Message) - build_pass("libstatic.h" "libstatic" "libstatic" "${Source}" ${Message}) -endmacro() - -macro(static_build_fail Source Message) - build_fail("libstatic.h" "libstatic" "libstatic" "${Source}" ${Message}) -endmacro() - -static_build_pass("Libstatic l; return l.libstatic_exported();" "Failed to build exported.") - -# if (COMPILER_HAS_DEPRECATED) -# static_build_fail("Libstatic l; return l.libstatic_deprecated();" "Built use of deprecated class method. This should not be possible.") -# static_build_fail("libstatic_deprecated();" "Built use of deprecated function. This should not be possible.") -# else() -# static_build_pass("Libstatic l; return l.libstatic_deprecated();" "Built use of deprecated class method. This should not be possible.") -# static_build_pass("libstatic_deprecated();" "Built use of deprecated function. This should not be possible.") -# endif() diff --git a/Tests/Module/GenerateExportHeader/override_symbol/CMakeLists.txt b/Tests/Module/GenerateExportHeader/override_symbol/CMakeLists.txt deleted file mode 100644 index aeeef20..0000000 --- a/Tests/Module/GenerateExportHeader/override_symbol/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -project(override_symbol) - -add_library(somelib SHARED someclass.cpp) - -set_target_properties(somelib PROPERTIES DEFINE_SYMBOL SOMELIB_MAKEDLL) - -generate_export_header(somelib) - -add_executable(consumer main.cpp) - -target_link_libraries(consumer somelib) diff --git a/Tests/Module/GenerateExportHeader/override_symbol/main.cpp b/Tests/Module/GenerateExportHeader/override_symbol/main.cpp deleted file mode 100644 index eec46d3..0000000 --- a/Tests/Module/GenerateExportHeader/override_symbol/main.cpp +++ /dev/null @@ -1,9 +0,0 @@ - -#include "someclass.h" - -int main(int, char**) -{ - SomeClass sc; - sc.someMethod(); - return 0; -} diff --git a/Tests/Module/GenerateExportHeader/override_symbol/someclass.cpp b/Tests/Module/GenerateExportHeader/override_symbol/someclass.cpp deleted file mode 100644 index 427ec29..0000000 --- a/Tests/Module/GenerateExportHeader/override_symbol/someclass.cpp +++ /dev/null @@ -1,7 +0,0 @@ - -#include "someclass.h" - -void SomeClass::someMethod() const -{ - -} diff --git a/Tests/Module/GenerateExportHeader/override_symbol/someclass.h b/Tests/Module/GenerateExportHeader/override_symbol/someclass.h deleted file mode 100644 index ae5e844..0000000 --- a/Tests/Module/GenerateExportHeader/override_symbol/someclass.h +++ /dev/null @@ -1,8 +0,0 @@ - -#include "somelib_export.h" - -class SOMELIB_EXPORT SomeClass -{ -public: - void someMethod() const; -}; diff --git a/Tests/Module/GenerateExportHeader/prefix/CMakeLists.txt b/Tests/Module/GenerateExportHeader/prefix/CMakeLists.txt deleted file mode 100644 index bd64df2..0000000 --- a/Tests/Module/GenerateExportHeader/prefix/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -project(use_prefix) - -set(use_prefix_lib_SRCS - useprefixclass.cpp -) - -add_library(use_prefix_lib SHARED useprefixclass.cpp) - -generate_export_header(use_prefix_lib - PREFIX_NAME MYPREFIX_ -) - -add_executable(use_prefix main.cpp) - -target_link_libraries(use_prefix use_prefix_lib)
\ No newline at end of file diff --git a/Tests/Module/GenerateExportHeader/prefix/main.cpp b/Tests/Module/GenerateExportHeader/prefix/main.cpp deleted file mode 100644 index 507f6fd..0000000 --- a/Tests/Module/GenerateExportHeader/prefix/main.cpp +++ /dev/null @@ -1,8 +0,0 @@ - -#include "useprefixclass.h" - -int main(int argc, char **argv) -{ - UsePrefixClass upc; - return upc.someMethod(); -} diff --git a/Tests/Module/GenerateExportHeader/prefix/useprefixclass.cpp b/Tests/Module/GenerateExportHeader/prefix/useprefixclass.cpp deleted file mode 100644 index 1fd2cb2..0000000 --- a/Tests/Module/GenerateExportHeader/prefix/useprefixclass.cpp +++ /dev/null @@ -1,7 +0,0 @@ - -#include "useprefixclass.h" - -int UsePrefixClass::someMethod() const -{ - return 0; -} diff --git a/Tests/Module/GenerateExportHeader/prefix/useprefixclass.h b/Tests/Module/GenerateExportHeader/prefix/useprefixclass.h deleted file mode 100644 index f5e31b5..0000000 --- a/Tests/Module/GenerateExportHeader/prefix/useprefixclass.h +++ /dev/null @@ -1,13 +0,0 @@ - -#ifndef USEPREFIXCLASS_H -#define USEPREFIXCLASS_H - -#include "use_prefix_lib_export.h" - -class MYPREFIX_USE_PREFIX_LIB_EXPORT UsePrefixClass -{ -public: - int someMethod() const; -}; - -#endif diff --git a/Tests/Module/GenerateExportHeader/reference/Empty/libshared_export.h b/Tests/Module/GenerateExportHeader/reference/Empty/libshared_export.h new file mode 100644 index 0000000..b6749b2 --- /dev/null +++ b/Tests/Module/GenerateExportHeader/reference/Empty/libshared_export.h @@ -0,0 +1,41 @@ + +#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 +# else + /* We are using this library */ +# define LIBSHARED_EXPORT +# endif +# endif + +# ifndef LIBSHARED_NO_EXPORT +# define LIBSHARED_NO_EXPORT +# endif +#endif + +#ifndef LIBSHARED_DEPRECATED +# define LIBSHARED_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 + +#define DEFINE_NO_DEPRECATED 0 +#if DEFINE_NO_DEPRECATED +# define LIBSHARED_NO_DEPRECATED +#endif + +#endif diff --git a/Tests/Module/GenerateExportHeader/reference/Empty/libstatic_export.h b/Tests/Module/GenerateExportHeader/reference/Empty/libstatic_export.h new file mode 100644 index 0000000..e8000e2 --- /dev/null +++ b/Tests/Module/GenerateExportHeader/reference/Empty/libstatic_export.h @@ -0,0 +1,41 @@ + +#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 +#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 + +#define DEFINE_NO_DEPRECATED 0 +#if DEFINE_NO_DEPRECATED +# define LIBSTATIC_NO_DEPRECATED +#endif + +#endif diff --git a/Tests/Module/GenerateExportHeader/reference/MinGW/libshared_export.h b/Tests/Module/GenerateExportHeader/reference/MinGW/libshared_export.h new file mode 100644 index 0000000..d376631 --- /dev/null +++ b/Tests/Module/GenerateExportHeader/reference/MinGW/libshared_export.h @@ -0,0 +1,41 @@ + +#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 + +#define DEFINE_NO_DEPRECATED 0 +#if DEFINE_NO_DEPRECATED +# define LIBSHARED_NO_DEPRECATED +#endif + +#endif diff --git a/Tests/Module/GenerateExportHeader/reference/MinGW/libstatic_export.h b/Tests/Module/GenerateExportHeader/reference/MinGW/libstatic_export.h new file mode 100644 index 0000000..fd021e9 --- /dev/null +++ b/Tests/Module/GenerateExportHeader/reference/MinGW/libstatic_export.h @@ -0,0 +1,41 @@ + +#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 + +#define DEFINE_NO_DEPRECATED 0 +#if DEFINE_NO_DEPRECATED +# define LIBSTATIC_NO_DEPRECATED +#endif + +#endif diff --git a/Tests/Module/GenerateExportHeader/reference/UNIX/libshared_export.h b/Tests/Module/GenerateExportHeader/reference/UNIX/libshared_export.h new file mode 100644 index 0000000..7d8087f --- /dev/null +++ b/Tests/Module/GenerateExportHeader/reference/UNIX/libshared_export.h @@ -0,0 +1,41 @@ + +#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 __attribute__((visibility("default"))) +# else + /* We are using this library */ +# define LIBSHARED_EXPORT __attribute__((visibility("default"))) +# endif +# endif + +# ifndef LIBSHARED_NO_EXPORT +# define LIBSHARED_NO_EXPORT __attribute__((visibility("hidden"))) +# 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 + +#define DEFINE_NO_DEPRECATED 0 +#if DEFINE_NO_DEPRECATED +# define LIBSHARED_NO_DEPRECATED +#endif + +#endif diff --git a/Tests/Module/GenerateExportHeader/reference/UNIX/libstatic_export.h b/Tests/Module/GenerateExportHeader/reference/UNIX/libstatic_export.h new file mode 100644 index 0000000..fd021e9 --- /dev/null +++ b/Tests/Module/GenerateExportHeader/reference/UNIX/libstatic_export.h @@ -0,0 +1,41 @@ + +#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 + +#define DEFINE_NO_DEPRECATED 0 +#if DEFINE_NO_DEPRECATED +# define LIBSTATIC_NO_DEPRECATED +#endif + +#endif diff --git a/Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h b/Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h new file mode 100644 index 0000000..5681f58 --- /dev/null +++ b/Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h @@ -0,0 +1,41 @@ + +#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 +# else + /* We are using this library */ +# define LIBSHARED_EXPORT +# 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 + +#define DEFINE_NO_DEPRECATED 0 +#if DEFINE_NO_DEPRECATED +# define LIBSHARED_NO_DEPRECATED +#endif + +#endif diff --git a/Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h b/Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h new file mode 100644 index 0000000..fd021e9 --- /dev/null +++ b/Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h @@ -0,0 +1,41 @@ + +#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 + +#define DEFINE_NO_DEPRECATED 0 +#if DEFINE_NO_DEPRECATED +# define LIBSTATIC_NO_DEPRECATED +#endif + +#endif diff --git a/Tests/Module/GenerateExportHeader/reference/Win32/libshared_export.h b/Tests/Module/GenerateExportHeader/reference/Win32/libshared_export.h new file mode 100644 index 0000000..976c92e --- /dev/null +++ b/Tests/Module/GenerateExportHeader/reference/Win32/libshared_export.h @@ -0,0 +1,41 @@ + +#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 __declspec(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 + +#define DEFINE_NO_DEPRECATED 0 +#if DEFINE_NO_DEPRECATED +# define LIBSHARED_NO_DEPRECATED +#endif + +#endif diff --git a/Tests/Module/GenerateExportHeader/reference/Win32/libstatic_export.h b/Tests/Module/GenerateExportHeader/reference/Win32/libstatic_export.h new file mode 100644 index 0000000..db4df61 --- /dev/null +++ b/Tests/Module/GenerateExportHeader/reference/Win32/libstatic_export.h @@ -0,0 +1,41 @@ + +#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 __declspec(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 + +#define DEFINE_NO_DEPRECATED 0 +#if DEFINE_NO_DEPRECATED +# define LIBSTATIC_NO_DEPRECATED +#endif + +#endif diff --git a/Tests/Module/GenerateExportHeader/reference/WinEmpty/libshared_export.h b/Tests/Module/GenerateExportHeader/reference/WinEmpty/libshared_export.h new file mode 100644 index 0000000..2dc41d4 --- /dev/null +++ b/Tests/Module/GenerateExportHeader/reference/WinEmpty/libshared_export.h @@ -0,0 +1,41 @@ + +#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 +#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 + +#define DEFINE_NO_DEPRECATED 0 +#if DEFINE_NO_DEPRECATED +# define LIBSHARED_NO_DEPRECATED +#endif + +#endif diff --git a/Tests/Module/GenerateExportHeader/reference/WinEmpty/libstatic_export.h b/Tests/Module/GenerateExportHeader/reference/WinEmpty/libstatic_export.h new file mode 100644 index 0000000..e8000e2 --- /dev/null +++ b/Tests/Module/GenerateExportHeader/reference/WinEmpty/libstatic_export.h @@ -0,0 +1,41 @@ + +#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 +#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 + +#define DEFINE_NO_DEPRECATED 0 +#if DEFINE_NO_DEPRECATED +# define LIBSTATIC_NO_DEPRECATED +#endif + +#endif diff --git a/Tests/Module/GenerateExportHeader/visibility_preset/CMakeLists.txt b/Tests/Module/GenerateExportHeader/visibility_preset/CMakeLists.txt deleted file mode 100644 index 2571d22..0000000 --- a/Tests/Module/GenerateExportHeader/visibility_preset/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ - -set(CMAKE_CXX_VISIBILITY_PRESET hidden) -set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) - -if (CMAKE_CXX_FLAGS MATCHES "-fvisibility=hidden") - message(SEND_ERROR "Do not use add_compiler_export_flags before adding this directory") -endif() -if (CMAKE_CXX_FLAGS MATCHES "-fvisibility-inlines-hidden") - message(SEND_ERROR "Do not use add_compiler_export_flags before adding this directory") -endif() - -add_library(visibility_preset SHARED visibility_preset.cpp) -generate_export_header(visibility_preset) - -add_executable(visibility_preset_exe main.cpp) - -target_link_libraries(visibility_preset_exe visibility_preset) diff --git a/Tests/Module/GenerateExportHeader/visibility_preset/main.cpp b/Tests/Module/GenerateExportHeader/visibility_preset/main.cpp deleted file mode 100644 index 89c3977..0000000 --- a/Tests/Module/GenerateExportHeader/visibility_preset/main.cpp +++ /dev/null @@ -1,9 +0,0 @@ - -#include "visibility_preset.h" - -int main() -{ - VisibilityPreset vp; - vp.someMethod(); - return 0; -} diff --git a/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.cpp b/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.cpp deleted file mode 100644 index c97dec6..0000000 --- a/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.cpp +++ /dev/null @@ -1,7 +0,0 @@ - -#include "visibility_preset.h" - -void VisibilityPreset::someMethod() -{ - -} diff --git a/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.h b/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.h deleted file mode 100644 index 8becbe1..0000000 --- a/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.h +++ /dev/null @@ -1,13 +0,0 @@ - -#ifndef VISIBILITY_PRESET_H -#define VISIBILITY_PRESET_H - -#include "visibility_preset_export.h" - -class VISIBILITY_PRESET_EXPORT VisibilityPreset -{ -public: - void someMethod(); -}; - -#endif diff --git a/Tests/ObjectLibrary/CMakeLists.txt b/Tests/ObjectLibrary/CMakeLists.txt index 13a07b4..0aeefaa 100644 --- a/Tests/ObjectLibrary/CMakeLists.txt +++ b/Tests/ObjectLibrary/CMakeLists.txt @@ -58,3 +58,5 @@ target_compile_definitions(ABmain PUBLIC $<TARGET_PROPERTY:B,INTERFACE_COMPILE_D add_executable(UseABinternal ${dummy} $<TARGET_OBJECTS:ABmain> $<TARGET_OBJECTS:A> $<TARGET_OBJECTS:B> ) + +add_subdirectory(ExportLanguages) diff --git a/Tests/ObjectLibrary/ExportLanguages/CMakeLists.txt b/Tests/ObjectLibrary/ExportLanguages/CMakeLists.txt new file mode 100644 index 0000000..22c92a7 --- /dev/null +++ b/Tests/ObjectLibrary/ExportLanguages/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 2.8) +project(ExportLanguages CXX) +add_library(ExportLanguagesA OBJECT a.cxx) +add_library(ExportLanguagesB STATIC a.c $<TARGET_OBJECTS:ExportLanguagesA>) + +# Verify that object library languages are propagated. +export(TARGETS ExportLanguagesB NAMESPACE Exp FILE BExport.cmake) +include(ExternalProject) +ExternalProject_Add(ExportLanguagesTest + SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ExportLanguagesTest" + BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/ExportLanguagesTest" + DOWNLOAD_COMMAND "" + INSTALL_COMMAND "" +) +add_dependencies(ExportLanguagesTest ExportLanguagesA ExportLanguagesB) diff --git a/Tests/ObjectLibrary/ExportLanguages/ExportLanguagesTest/CMakeLists.txt b/Tests/ObjectLibrary/ExportLanguages/ExportLanguagesTest/CMakeLists.txt new file mode 100644 index 0000000..fc8dd2b --- /dev/null +++ b/Tests/ObjectLibrary/ExportLanguages/ExportLanguagesTest/CMakeLists.txt @@ -0,0 +1,14 @@ + +cmake_minimum_required(VERSION 2.8) + +project(ExportLanguagesTest) + +include(${CMAKE_CURRENT_BINARY_DIR}/../BExport.cmake) +get_property(configs TARGET ExpExportLanguagesB PROPERTY IMPORTED_CONFIGURATIONS) +foreach(c ${configs}) + get_property(langs TARGET ExpExportLanguagesB PROPERTY IMPORTED_LINK_INTERFACE_LANGUAGES_${c}) + list(FIND langs CXX pos) + if(${pos} LESS 0) + message(FATAL_ERROR "Target export does not list object library languages.") + endif() +endforeach() diff --git a/Tests/ObjectLibrary/ExportLanguages/a.c b/Tests/ObjectLibrary/ExportLanguages/a.c new file mode 100644 index 0000000..af20d3f --- /dev/null +++ b/Tests/ObjectLibrary/ExportLanguages/a.c @@ -0,0 +1 @@ +int a(void) { return 0; } diff --git a/Tests/RunCMake/ObjectLibrary/a.cxx b/Tests/ObjectLibrary/ExportLanguages/a.cxx index ae9c87c..ae9c87c 100644 --- a/Tests/RunCMake/ObjectLibrary/a.cxx +++ b/Tests/ObjectLibrary/ExportLanguages/a.cxx diff --git a/Tests/Plugin/CMakeLists.txt b/Tests/Plugin/CMakeLists.txt index d1b8334..c6ed15d 100644 --- a/Tests/Plugin/CMakeLists.txt +++ b/Tests/Plugin/CMakeLists.txt @@ -50,37 +50,15 @@ if(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG AND # Verify that targets export with proper IMPORTED SONAME properties. export(TARGETS example_mod_1 example_mod_2 NAMESPACE exp_ FILE ${CMAKE_CURRENT_BINARY_DIR}/mods.cmake) - include(${CMAKE_CURRENT_BINARY_DIR}/mods.cmake) - get_property(configs TARGET exp_example_mod_1 PROPERTY IMPORTED_CONFIGURATIONS) - foreach(c ${configs}) - string(TOUPPER "${c}" CONFIG) - get_property(soname1 TARGET exp_example_mod_1 PROPERTY IMPORTED_SONAME_${CONFIG}) - get_property(soname2 TARGET exp_example_mod_2 PROPERTY IMPORTED_NO_SONAME_${CONFIG}) - if(soname1) - message(STATUS "exp_example_mod_1 has IMPORTED_SONAME_${CONFIG} as expected: ${soname1}") - else() - message(SEND_ERROR "exp_example_mod_1 does not have IMPORTED_SONAME_${CONFIG} but should") - endif() - if(soname2) - message(STATUS "exp_example_mod_2 has IMPORTED_NO_SONAME_${CONFIG} as expected: ${soname2}") - else() - message(SEND_ERROR "exp_example_mod_2 does not have IMPORTED_NO_SONAME_${CONFIG} but should") - endif() - endforeach() - # Parse the binary to check for SONAME if possible. - if("${CMAKE_EXECUTABLE_FORMAT}" MATCHES "ELF") - find_program(READELF_EXE readelf) - if(READELF_EXE) - add_custom_target(check_mod_soname ALL COMMAND - ${CMAKE_COMMAND} -Dreadelf=${READELF_EXE} - -Dmod1=$<TARGET_FILE:example_mod_1> - -Dmod2=$<TARGET_FILE:example_mod_2> - -P ${CMAKE_CURRENT_SOURCE_DIR}/check_mod_soname.cmake - ) - add_dependencies(check_mod_soname example_mod_1 example_mod_2) - endif() - endif() + include(ExternalProject) + ExternalProject_Add(PluginTest + SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/PluginTest" + BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/PluginTest" + DOWNLOAD_COMMAND "" + INSTALL_COMMAND "" + ) + add_dependencies(PluginTest example_mod_1 example_mod_2) endif() # TODO: diff --git a/Tests/Plugin/PluginTest/CMakeLists.txt b/Tests/Plugin/PluginTest/CMakeLists.txt new file mode 100644 index 0000000..79ef8a9 --- /dev/null +++ b/Tests/Plugin/PluginTest/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 2.8) + +project(PluginTest) + +include(${CMAKE_CURRENT_BINARY_DIR}/../mods.cmake) +get_property(configs TARGET exp_example_mod_1 PROPERTY IMPORTED_CONFIGURATIONS) +foreach(c ${configs}) + string(TOUPPER "${c}" CONFIG) + get_property(soname1 TARGET exp_example_mod_1 PROPERTY IMPORTED_SONAME_${CONFIG}) + get_property(soname2 TARGET exp_example_mod_2 PROPERTY IMPORTED_NO_SONAME_${CONFIG}) + if(soname1) + message(STATUS "exp_example_mod_1 has IMPORTED_SONAME_${CONFIG} as expected: ${soname1}") + else() + message(SEND_ERROR "exp_example_mod_1 does not have IMPORTED_SONAME_${CONFIG} but should") + endif() + if(soname2) + message(STATUS "exp_example_mod_2 has IMPORTED_NO_SONAME_${CONFIG} as expected: ${soname2}") + else() + message(SEND_ERROR "exp_example_mod_2 does not have IMPORTED_NO_SONAME_${CONFIG} but should") + endif() +endforeach() + +# Parse the binary to check for SONAME if possible. +if("${CMAKE_EXECUTABLE_FORMAT}" MATCHES "ELF") + find_program(READELF_EXE readelf) + if(READELF_EXE) + add_custom_target(check_mod_soname ALL COMMAND + ${CMAKE_COMMAND} -Dreadelf=${READELF_EXE} + -Dmod1=$<TARGET_FILE:exp_example_mod_1> + -Dmod2=$<TARGET_FILE:exp_example_mod_2> + -P ${CMAKE_CURRENT_SOURCE_DIR}/../check_mod_soname.cmake + ) + endif() +endif() diff --git a/Tests/PositionIndependentTargets/CMakeLists.txt b/Tests/PositionIndependentTargets/CMakeLists.txt index eec893d..e79f3b7 100644 --- a/Tests/PositionIndependentTargets/CMakeLists.txt +++ b/Tests/PositionIndependentTargets/CMakeLists.txt @@ -9,5 +9,6 @@ include_directories("${CMAKE_CURRENT_SOURCE_DIR}") # For pic_test.h add_subdirectory(global) add_subdirectory(targets) +add_subdirectory(interface) add_executable(PositionIndependentTargets main.cpp) diff --git a/Tests/PositionIndependentTargets/interface/CMakeLists.txt b/Tests/PositionIndependentTargets/interface/CMakeLists.txt new file mode 100644 index 0000000..65f3b76 --- /dev/null +++ b/Tests/PositionIndependentTargets/interface/CMakeLists.txt @@ -0,0 +1,27 @@ + +add_library(piciface INTERFACE) +set_property(TARGET piciface PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE ON) + +add_executable(test_empty_iface "${CMAKE_CURRENT_SOURCE_DIR}/../pic_main.cpp") +target_link_libraries(test_empty_iface piciface) + +add_library(sharedlib SHARED "${CMAKE_CURRENT_SOURCE_DIR}/../pic_lib.cpp") +target_link_libraries(sharedlib piciface) +set_property(TARGET sharedlib PROPERTY DEFINE_SYMBOL PIC_TEST_BUILD_DLL) + +add_executable(test_iface_via_shared "${CMAKE_CURRENT_SOURCE_DIR}/../pic_main.cpp") +target_link_libraries(test_iface_via_shared sharedlib) + +add_library(sharedlibpic SHARED "${CMAKE_CURRENT_SOURCE_DIR}/../pic_lib.cpp") +set_property(TARGET sharedlibpic PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE ON) +set_property(TARGET sharedlibpic PROPERTY DEFINE_SYMBOL PIC_TEST_BUILD_DLL) + +add_library(shared_iface INTERFACE) +target_link_libraries(shared_iface INTERFACE sharedlibpic) + +add_executable(test_shared_via_iface "${CMAKE_CURRENT_SOURCE_DIR}/../pic_main.cpp") +target_link_libraries(test_shared_via_iface shared_iface) + +add_executable(test_shared_via_iface_non_conflict "${CMAKE_CURRENT_SOURCE_DIR}/../pic_main.cpp") +set_property(TARGET test_shared_via_iface_non_conflict PROPERTY POSITION_INDEPENDENT_CODE ON) +target_link_libraries(test_shared_via_iface_non_conflict shared_iface) diff --git a/Tests/PythonCoverage/DartConfiguration.tcl.in b/Tests/PythonCoverage/DartConfiguration.tcl.in new file mode 100644 index 0000000..e29cffe --- /dev/null +++ b/Tests/PythonCoverage/DartConfiguration.tcl.in @@ -0,0 +1,8 @@ +# This file is configured by CMake automatically as DartConfiguration.tcl +# If you choose not to use CMake, this file may be hand configured, by +# filling in the required variables. + + +# Configuration directories and files +SourceDirectory: ${CMake_BINARY_DIR}/Testing/PythonCoverage/coveragetest +BuildDirectory: ${CMake_BINARY_DIR}/Testing/PythonCoverage diff --git a/Tests/PythonCoverage/coverage.xml.in b/Tests/PythonCoverage/coverage.xml.in new file mode 100644 index 0000000..fcc1b1c --- /dev/null +++ b/Tests/PythonCoverage/coverage.xml.in @@ -0,0 +1,35 @@ +<?xml version="1.0" ?> +<!DOCTYPE coverage + SYSTEM 'http://cobertura.sourceforge.net/xml/coverage-03.dtd'> +<coverage branch-rate="0" line-rate="0.8462" timestamp="1380469411433" version="3.6"> + <!-- Generated by coverage.py: http://nedbatchelder.com/code/coverage --> + <packages> + <package branch-rate="0" complexity="0" line-rate="0.8462" name=""> + <classes> + <class branch-rate="0" complexity="0" filename="foo.py" line-rate="0.6667" name="foo"> + <methods/> + <lines> + <line hits="1" number="2"/> + <line hits="1" number="3"/> + <line hits="1" number="4"/> + <line hits="1" number="6"/> + <line hits="0" number="7"/> + <line hits="0" number="8"/> + </lines> + </class> + <class branch-rate="0" complexity="0" filename="test_foo.py" line-rate="1" name="test_foo"> + <methods/> + <lines> + <line hits="1" number="2"/> + <line hits="1" number="3"/> + <line hits="1" number="5"/> + <line hits="1" number="7"/> + <line hits="1" number="8"/> + <line hits="1" number="10"/> + <line hits="1" number="11"/> + </lines> + </class> + </classes> + </package> + </packages> +</coverage> diff --git a/Tests/PythonCoverage/coveragetest/foo.py b/Tests/PythonCoverage/coveragetest/foo.py new file mode 100644 index 0000000..97b5a41 --- /dev/null +++ b/Tests/PythonCoverage/coveragetest/foo.py @@ -0,0 +1,8 @@ + +def foo(): + x = 3 + 3 + return x + +def bar(): + y = 2 + 2 + return y diff --git a/Tests/PythonCoverage/coveragetest/test_foo.py b/Tests/PythonCoverage/coveragetest/test_foo.py new file mode 100644 index 0000000..51a69d8 --- /dev/null +++ b/Tests/PythonCoverage/coveragetest/test_foo.py @@ -0,0 +1,11 @@ + +import foo +import unittest + +class TestFoo(unittest.TestCase): + + def testFoo(self): + self.assertEquals(foo.foo(), 6, 'foo() == 6') + +if __name__ == '__main__': + unittest.main() diff --git a/Tests/QtAutoUicInterface/CMakeLists.txt b/Tests/QtAutoUicInterface/CMakeLists.txt new file mode 100644 index 0000000..555f016 --- /dev/null +++ b/Tests/QtAutoUicInterface/CMakeLists.txt @@ -0,0 +1,70 @@ + +cmake_minimum_required(VERSION 2.8.12) + +project(QtAutoUicInterface) + +if (QT_TEST_VERSION STREQUAL 4) + find_package(Qt4 REQUIRED) + + include(UseQt4) + + set(QT_CORE_TARGET Qt4::QtCore) + set(QT_GUI_TARGET Qt4::QtGui) +else() + if (NOT QT_TEST_VERSION STREQUAL 5) + message(SEND_ERROR "Invalid Qt version specified.") + endif() + find_package(Qt5Widgets REQUIRED) + + set(QT_CORE_TARGET Qt5::Core) + set(QT_GUI_TARGET Qt5::Widgets) +endif() + +set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) +set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) + +# BEGIN Upstream + +set(CMAKE_VERBOSE_MAKEFILE ON) + +add_library(KI18n klocalizedstring.cpp) +target_link_libraries(KI18n ${QT_CORE_TARGET}) + +set(autouic_options + -tr tr2$<$<NOT:$<BOOL:$<TARGET_PROPERTY:NO_KUIT_SEMANTIC>>>:x>i18n +) +if (NOT Qt5Widgets_VERSION VERSION_LESS 5.3.0) + list(APPEND autouic_options -include klocalizedstring.h) +endif() + +set_property(TARGET KI18n APPEND PROPERTY + INTERFACE_AUTOUIC_OPTIONS ${autouic_options} +) + +set(domainProp $<TARGET_PROPERTY:TRANSLATION_DOMAIN>) +set(nameLower $<LOWER_CASE:$<MAKE_C_IDENTIFIER:$<TARGET_PROPERTY:NAME>>>) +set(domain_logic + $<$<BOOL:${domainProp}>:${domainProp}>$<$<NOT:$<BOOL:${domainProp}>>:${nameLower}> +) +set_property(TARGET KI18n APPEND PROPERTY + INTERFACE_COMPILE_DEFINITIONS "TRANSLATION_DOMAIN=${domain_logic}" +) + +# END upstream + +add_library(LibWidget libwidget.cpp) +target_link_libraries(LibWidget KI18n ${QT_GUI_TARGET}) +set_property(TARGET LibWidget PROPERTY NO_KUIT_SEMANTIC ON) +set_property(TARGET LibWidget PROPERTY TRANSLATION_DOMAIN customdomain) + +add_library(MyWidget mywidget.cpp) +target_link_libraries(MyWidget KI18n ${QT_GUI_TARGET}) + +add_executable(QtAutoUicInterface main.cpp) +target_compile_definitions(QtAutoUicInterface + PRIVATE + UI_LIBWIDGET_H="${CMAKE_CURRENT_BINARY_DIR}/ui_libwidget.h" + UI_MYWIDGET_H="${CMAKE_CURRENT_BINARY_DIR}/ui_mywidget.h" +) diff --git a/Tests/QtAutoUicInterface/klocalizedstring.cpp b/Tests/QtAutoUicInterface/klocalizedstring.cpp new file mode 100644 index 0000000..f2324bb --- /dev/null +++ b/Tests/QtAutoUicInterface/klocalizedstring.cpp @@ -0,0 +1,12 @@ + +#include "klocalizedstring.h" + +QString tr2xi18n(const char *text, const char *) +{ + return QLatin1String("TranslatedX") + QString::fromLatin1(text); +} + +QString tr2i18n(const char *text, const char *) +{ + return QLatin1String("Translated") + QString::fromLatin1(text); +} diff --git a/Tests/QtAutoUicInterface/klocalizedstring.h b/Tests/QtAutoUicInterface/klocalizedstring.h new file mode 100644 index 0000000..559058f --- /dev/null +++ b/Tests/QtAutoUicInterface/klocalizedstring.h @@ -0,0 +1,17 @@ + +#ifndef KLOCALIZEDSTRING_H +#define KLOCALIZEDSTRING_H + +#include <QString> + +#ifdef _WIN32 +__declspec(dllexport) +#endif +QString tr2xi18n(const char *text, const char *comment = 0); + +#ifdef _WIN32 +__declspec(dllexport) +#endif +QString tr2i18n(const char *text, const char *comment = 0); + +#endif diff --git a/Tests/QtAutoUicInterface/libwidget.cpp b/Tests/QtAutoUicInterface/libwidget.cpp new file mode 100644 index 0000000..8a921b3 --- /dev/null +++ b/Tests/QtAutoUicInterface/libwidget.cpp @@ -0,0 +1,9 @@ + +#include "libwidget.h" + +LibWidget::LibWidget(QWidget *parent) + : QWidget(parent), + ui(new Ui::LibWidget) +{ + ui->setupUi(this); +} diff --git a/Tests/QtAutoUicInterface/libwidget.h b/Tests/QtAutoUicInterface/libwidget.h new file mode 100644 index 0000000..8b592ec --- /dev/null +++ b/Tests/QtAutoUicInterface/libwidget.h @@ -0,0 +1,24 @@ + +#ifndef LIBWIDGET_H +#define LIBWIDGET_H + +#include <QWidget> +#include <memory> + +#if QT_VERSION < QT_VERSION_CHECK(5, 3, 0) +#include <klocalizedstring.h> +#endif + +#include "ui_libwidget.h" + +class LibWidget : public QWidget +{ + Q_OBJECT +public: + explicit LibWidget(QWidget *parent = 0); + +private: + const std::auto_ptr<Ui::LibWidget> ui; +}; + +#endif diff --git a/Tests/QtAutoUicInterface/libwidget.ui b/Tests/QtAutoUicInterface/libwidget.ui new file mode 100644 index 0000000..897371e --- /dev/null +++ b/Tests/QtAutoUicInterface/libwidget.ui @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>LibWidget</class> + <widget class="QWidget" name="LibWidget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <widget class="QLabel" name="label"> + <property name="geometry"> + <rect> + <x>180</x> + <y>60</y> + <width>57</width> + <height>15</height> + </rect> + </property> + <property name="text"> + <string>LibLabel</string> + </property> + </widget> + </widget> + <resources/> + <connections/> +</ui> diff --git a/Tests/QtAutoUicInterface/main.cpp b/Tests/QtAutoUicInterface/main.cpp new file mode 100644 index 0000000..42d5958 --- /dev/null +++ b/Tests/QtAutoUicInterface/main.cpp @@ -0,0 +1,75 @@ + +#include <fstream> +#include <iostream> +#include <string> + +int main(int argc, char **argv) +{ + std::ifstream f; + f.open(UI_LIBWIDGET_H); + if (!f.is_open()) + { + std::cout << "Could not open \"" UI_LIBWIDGET_H "\"." << std::endl; + return -1; + } + + { + bool gotTr2i18n = false; + + while (!f.eof()) + { + std::string output; + getline(f, output); + if (!gotTr2i18n) + { + gotTr2i18n = output.find("tr2i18n") != std::string::npos; + } + if (output.find("tr2xi18n") != std::string::npos) + { + std::cout << "ui_libwidget,h uses tr2xi18n, though it should not." << std::endl; + return -1; + } + } + + if (!gotTr2i18n) + { + std::cout << "Did not find tr2i18n in ui_libwidget.h" << std::endl; + return -1; + } + } + + f.close(); + f.open(UI_MYWIDGET_H); + if (!f.is_open()) + { + std::cout << "Could not open \"" UI_MYWIDGET_H "\"." << std::endl; + return -1; + } + + { + bool gotTr2xi18n = false; + + while (!f.eof()) + { + std::string output; + getline(f, output); + if (!gotTr2xi18n) + { + gotTr2xi18n = output.find("tr2xi18n") != std::string::npos; + } + if (output.find("tr2i18n") != std::string::npos) + { + std::cout << "ui_mywidget,h uses tr2i18n, though it should not." << std::endl; + return -1; + } + } + if (!gotTr2xi18n) + { + std::cout << "Did not find tr2xi18n in ui_mywidget.h" << std::endl; + return -1; + } + } + f.close(); + + return 0; +} diff --git a/Tests/QtAutoUicInterface/mywidget.cpp b/Tests/QtAutoUicInterface/mywidget.cpp new file mode 100644 index 0000000..b528b1a --- /dev/null +++ b/Tests/QtAutoUicInterface/mywidget.cpp @@ -0,0 +1,9 @@ + +#include "mywidget.h" + +MyWidget::MyWidget(QWidget *parent) + : QWidget(parent), + ui(new Ui::MyWidget) +{ + ui->setupUi(this); +} diff --git a/Tests/QtAutoUicInterface/mywidget.h b/Tests/QtAutoUicInterface/mywidget.h new file mode 100644 index 0000000..c96fb98 --- /dev/null +++ b/Tests/QtAutoUicInterface/mywidget.h @@ -0,0 +1,24 @@ + +#ifndef MYWIDGET_H +#define MYWIDGET_H + +#include <QWidget> +#include <memory> + +#if QT_VERSION < QT_VERSION_CHECK(5, 3, 0) +#include <klocalizedstring.h> +#endif + +#include "ui_mywidget.h" + +class MyWidget : public QWidget +{ + Q_OBJECT +public: + explicit MyWidget(QWidget *parent = 0); + +private: + const std::auto_ptr<Ui::MyWidget> ui; +}; + +#endif diff --git a/Tests/QtAutoUicInterface/mywidget.ui b/Tests/QtAutoUicInterface/mywidget.ui new file mode 100644 index 0000000..b2b9cc5 --- /dev/null +++ b/Tests/QtAutoUicInterface/mywidget.ui @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>MyWidget</class> + <widget class="QWidget" name="MyWidget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <widget class="QPushButton" name="pushButton"> + <property name="geometry"> + <rect> + <x>110</x> + <y>40</y> + <width>81</width> + <height>23</height> + </rect> + </property> + <property name="text"> + <string>Special button</string> + </property> + </widget> + </widget> + <resources/> + <connections/> +</ui> diff --git a/Tests/QtAutomoc/Adir/CMakeLists.txt b/Tests/QtAutogen/Adir/CMakeLists.txt index a1c36ff..a1c36ff 100644 --- a/Tests/QtAutomoc/Adir/CMakeLists.txt +++ b/Tests/QtAutogen/Adir/CMakeLists.txt diff --git a/Tests/QtAutomoc/Adir/libA.cpp b/Tests/QtAutogen/Adir/libA.cpp index 3968c44..3968c44 100644 --- a/Tests/QtAutomoc/Adir/libA.cpp +++ b/Tests/QtAutogen/Adir/libA.cpp diff --git a/Tests/QtAutomoc/Adir/libA.h b/Tests/QtAutogen/Adir/libA.h index 03ad1e0..03ad1e0 100644 --- a/Tests/QtAutomoc/Adir/libA.h +++ b/Tests/QtAutogen/Adir/libA.h diff --git a/Tests/QtAutomoc/Bdir/CMakeLists.txt b/Tests/QtAutogen/Bdir/CMakeLists.txt index d9d4aa7..d9d4aa7 100644 --- a/Tests/QtAutomoc/Bdir/CMakeLists.txt +++ b/Tests/QtAutogen/Bdir/CMakeLists.txt diff --git a/Tests/QtAutomoc/Bdir/libB.cpp b/Tests/QtAutogen/Bdir/libB.cpp index 72f2cfa..72f2cfa 100644 --- a/Tests/QtAutomoc/Bdir/libB.cpp +++ b/Tests/QtAutogen/Bdir/libB.cpp diff --git a/Tests/QtAutomoc/Bdir/libB.h b/Tests/QtAutogen/Bdir/libB.h index 510c17f..510c17f 100644 --- a/Tests/QtAutomoc/Bdir/libB.h +++ b/Tests/QtAutogen/Bdir/libB.h diff --git a/Tests/QtAutomoc/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 69e52ac..7b99395 100644 --- a/Tests/QtAutomoc/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -1,6 +1,6 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.8.11) -project(QtAutomoc) +project(QtAutogen) if (QT_TEST_VERSION STREQUAL 4) find_package(Qt4 REQUIRED) @@ -35,15 +35,26 @@ add_definitions(-DFOO -DSomeDefine="Barx") # enable relaxed mode so automoc can handle all the special cases: set(CMAKE_AUTOMOC_RELAXED_MODE TRUE) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) + # create an executable and two library targets, each requiring automoc: add_library(codeeditorLib STATIC codeeditor.cpp) add_library(privateSlot OBJECT private_slot.cpp) -add_executable(foo main.cpp calwidget.cpp foo.cpp blub.cpp bar.cpp abc.cpp - xyz.cpp yaf.cpp $<TARGET_OBJECTS:privateSlot>) +add_custom_target(generate_moc_input + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/myinterface.h.in" "${CMAKE_CURRENT_BINARY_DIR}" + COMMAND ${CMAKE_COMMAND} -E rename "${CMAKE_CURRENT_BINARY_DIR}/myinterface.h.in" "${CMAKE_CURRENT_BINARY_DIR}/myinterface.h" +) + +add_executable(QtAutogen main.cpp calwidget.cpp foo.cpp blub.cpp bar.cpp abc.cpp + xyz.cpp yaf.cpp gadget.cpp $<TARGET_OBJECTS:privateSlot> + test.qrc resourcetester.cpp generated.cpp +) +set_property(TARGET QtAutogen APPEND PROPERTY AUTOGEN_TARGET_DEPENDS generate_moc_input) -set_target_properties(foo codeeditorLib privateSlot PROPERTIES AUTOMOC TRUE) +set_target_properties(QtAutogen codeeditorLib privateSlot PROPERTIES AUTOMOC TRUE) include(GenerateExportHeader) # The order is relevant here. B depends on A, and B headers depend on A @@ -59,7 +70,7 @@ set_target_properties(libC PROPERTIES AUTOMOC TRUE) generate_export_header(libC) target_link_libraries(libC LINK_PUBLIC libB) -target_link_libraries(foo codeeditorLib ${QT_LIBRARIES} libC) +target_link_libraries(QtAutogen codeeditorLib ${QT_LIBRARIES} libC) add_library(empty STATIC empty.cpp) set_target_properties(empty PROPERTIES AUTOMOC TRUE) diff --git a/Tests/QtAutomoc/abc.cpp b/Tests/QtAutogen/abc.cpp index 4bbc769..4bbc769 100644 --- a/Tests/QtAutomoc/abc.cpp +++ b/Tests/QtAutogen/abc.cpp diff --git a/Tests/QtAutomoc/abc.h b/Tests/QtAutogen/abc.h index d1924b0..d1924b0 100644 --- a/Tests/QtAutomoc/abc.h +++ b/Tests/QtAutogen/abc.h diff --git a/Tests/QtAutomoc/abc_p.h b/Tests/QtAutogen/abc_p.h index 952fff3..952fff3 100644 --- a/Tests/QtAutomoc/abc_p.h +++ b/Tests/QtAutogen/abc_p.h diff --git a/Tests/QtAutomoc/bar.cpp b/Tests/QtAutogen/bar.cpp index 8be4815..8be4815 100644 --- a/Tests/QtAutomoc/bar.cpp +++ b/Tests/QtAutogen/bar.cpp diff --git a/Tests/QtAutomoc/blub.cpp b/Tests/QtAutogen/blub.cpp index bd53972..bd53972 100644 --- a/Tests/QtAutomoc/blub.cpp +++ b/Tests/QtAutogen/blub.cpp diff --git a/Tests/QtAutomoc/blub.h b/Tests/QtAutogen/blub.h index 1967bc1..1967bc1 100644 --- a/Tests/QtAutomoc/blub.h +++ b/Tests/QtAutogen/blub.h diff --git a/Tests/QtAutomoc/calwidget.cpp b/Tests/QtAutogen/calwidget.cpp index cbfa5a8..defde20 100644 --- a/Tests/QtAutomoc/calwidget.cpp +++ b/Tests/QtAutogen/calwidget.cpp @@ -49,7 +49,10 @@ #include "calwidget.h" + #include "ui_calwidget.h" + Window::Window() + : ui(new Ui::Window) { createPreviewGroupBox(); createGeneralOptionsGroupBox(); diff --git a/Tests/QtAutomoc/calwidget.h b/Tests/QtAutogen/calwidget.h index 8447389..d21a473 100644 --- a/Tests/QtAutomoc/calwidget.h +++ b/Tests/QtAutogen/calwidget.h @@ -52,6 +52,11 @@ class QGroupBox; class QLabel; + namespace Ui + { + class Window; + } + class Window : public QWidget { Q_OBJECT @@ -116,6 +121,8 @@ QCheckBox *firstFridayCheckBox; QCheckBox *mayFirstCheckBox; + + Ui::Window *ui; }; #endif diff --git a/Tests/QtAutogen/calwidget.ui b/Tests/QtAutogen/calwidget.ui new file mode 100644 index 0000000..1c245ca --- /dev/null +++ b/Tests/QtAutogen/calwidget.ui @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Window</class> + <widget class="QWidget" name="Window"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <widget class="QPushButton" name="pushButton"> + <property name="geometry"> + <rect> + <x>90</x> + <y>180</y> + <width>94</width> + <height>24</height> + </rect> + </property> + <property name="text"> + <string>PushButton</string> + </property> + </widget> + </widget> + <resources/> + <connections/> +</ui> diff --git a/Tests/QtAutomoc/codeeditor.cpp b/Tests/QtAutogen/codeeditor.cpp index 01da062..01da062 100644 --- a/Tests/QtAutomoc/codeeditor.cpp +++ b/Tests/QtAutogen/codeeditor.cpp diff --git a/Tests/QtAutomoc/codeeditor.h b/Tests/QtAutogen/codeeditor.h index 56e9e792..56e9e792 100644 --- a/Tests/QtAutomoc/codeeditor.h +++ b/Tests/QtAutogen/codeeditor.h diff --git a/Tests/QtAutomoc/defines_test/CMakeLists.txt b/Tests/QtAutogen/defines_test/CMakeLists.txt index ad4e684..ad4e684 100644 --- a/Tests/QtAutomoc/defines_test/CMakeLists.txt +++ b/Tests/QtAutogen/defines_test/CMakeLists.txt diff --git a/Tests/QtAutomoc/defines_test/defines_test.cpp b/Tests/QtAutogen/defines_test/defines_test.cpp index 2836d35..2836d35 100644 --- a/Tests/QtAutomoc/defines_test/defines_test.cpp +++ b/Tests/QtAutogen/defines_test/defines_test.cpp diff --git a/Tests/QtAutomoc/empty.cpp b/Tests/QtAutogen/empty.cpp index ab32cf6..ab32cf6 100644 --- a/Tests/QtAutomoc/empty.cpp +++ b/Tests/QtAutogen/empty.cpp diff --git a/Tests/QtAutomoc/empty.h b/Tests/QtAutogen/empty.h index 4566142..4566142 100644 --- a/Tests/QtAutomoc/empty.h +++ b/Tests/QtAutogen/empty.h diff --git a/Tests/QtAutomoc/foo.cpp b/Tests/QtAutogen/foo.cpp index 699ba09..699ba09 100644 --- a/Tests/QtAutomoc/foo.cpp +++ b/Tests/QtAutogen/foo.cpp diff --git a/Tests/QtAutomoc/foo.h b/Tests/QtAutogen/foo.h index 32d4c8d..f23ec07 100644 --- a/Tests/QtAutomoc/foo.h +++ b/Tests/QtAutogen/foo.h @@ -16,7 +16,10 @@ #include <QObject> -class Foo : public QObject +class Foo +#ifdef FOO + : public QObject +#endif { Q_OBJECT public: diff --git a/Tests/QtAutogen/gadget.cpp b/Tests/QtAutogen/gadget.cpp new file mode 100644 index 0000000..23d95fa --- /dev/null +++ b/Tests/QtAutogen/gadget.cpp @@ -0,0 +1,4 @@ + +#include "gadget.h" + +#include "moc_gadget.cpp" diff --git a/Tests/QtAutogen/gadget.h b/Tests/QtAutogen/gadget.h new file mode 100644 index 0000000..7c688ee --- /dev/null +++ b/Tests/QtAutogen/gadget.h @@ -0,0 +1,18 @@ + +#ifndef GADGET_H +#define GADGET_H + +#include <QObject> + +class Gadget +{ + Q_GADGET + Q_ENUMS(Type) +public: + enum Type { + Type0, + Type1 + }; +}; + +#endif diff --git a/Tests/QtAutogen/generated.cpp b/Tests/QtAutogen/generated.cpp new file mode 100644 index 0000000..f53bf53 --- /dev/null +++ b/Tests/QtAutogen/generated.cpp @@ -0,0 +1,10 @@ + +#include "generated.h" + +Generated::Generated(QObject *parent) + : QObject(parent) +{ + +} + +#include "moc_generated.cpp" diff --git a/Tests/QtAutogen/generated.h b/Tests/QtAutogen/generated.h new file mode 100644 index 0000000..dd22489 --- /dev/null +++ b/Tests/QtAutogen/generated.h @@ -0,0 +1,17 @@ + +#ifndef GENERATED_H +#define GENERATED_H + +#include <QObject> + +#include "myinterface.h" + +class Generated : public QObject, MyInterface +{ + Q_OBJECT + Q_INTERFACES(MyInterface) +public: + explicit Generated(QObject *parent = 0); +}; + +#endif diff --git a/Tests/QtAutomoc/libC.cpp b/Tests/QtAutogen/libC.cpp index 8d61cb1..8d61cb1 100644 --- a/Tests/QtAutomoc/libC.cpp +++ b/Tests/QtAutogen/libC.cpp diff --git a/Tests/QtAutomoc/libC.h b/Tests/QtAutogen/libC.h index 4fb4a2c..4fb4a2c 100644 --- a/Tests/QtAutomoc/libC.h +++ b/Tests/QtAutogen/libC.h diff --git a/Tests/QtAutomoc/main.cpp b/Tests/QtAutogen/main.cpp index bd80180..c8a036e 100644 --- a/Tests/QtAutomoc/main.cpp +++ b/Tests/QtAutogen/main.cpp @@ -38,7 +38,8 @@ ** ****************************************************************************/ -#include <QApplication> +#include <QCoreApplication> +#include <QTimer> #include "codeeditor.h" #include "calwidget.h" @@ -49,17 +50,11 @@ #include "xyz.h" #include "yaf.h" #include "libC.h" +#include "resourcetester.h" int main(int argv, char **args) { - QApplication app(argv, args); - - CodeEditor editor; - editor.setWindowTitle(QObject::tr("Code Editor Example")); - editor.show(); - - Window w; - w.show(); + QCoreApplication app(argv, args); Foo foo; foo.doFoo(); @@ -82,5 +77,9 @@ int main(int argv, char **args) LibC lc; lc.foo(); + ResourceTester rt; + + QTimer::singleShot(0, &rt, SLOT(doTest())); + return app.exec(); } diff --git a/Tests/QtAutogen/myinterface.h.in b/Tests/QtAutogen/myinterface.h.in new file mode 100644 index 0000000..c6c0ba1 --- /dev/null +++ b/Tests/QtAutogen/myinterface.h.in @@ -0,0 +1,14 @@ + +#ifndef MYINTERFACE_H +#define MYINTERFACE_H + +#include <QObject> + +class MyInterface +{ + +}; + +Q_DECLARE_INTERFACE(MyInterface, "org.cmake.example.MyInterface") + +#endif diff --git a/Tests/QtAutomoc/private_slot.cpp b/Tests/QtAutogen/private_slot.cpp index 1387a70..1387a70 100644 --- a/Tests/QtAutomoc/private_slot.cpp +++ b/Tests/QtAutogen/private_slot.cpp diff --git a/Tests/QtAutomoc/private_slot.h b/Tests/QtAutogen/private_slot.h index 28e5448..28e5448 100644 --- a/Tests/QtAutomoc/private_slot.h +++ b/Tests/QtAutogen/private_slot.h diff --git a/Tests/QtAutogen/resourcetester.cpp b/Tests/QtAutogen/resourcetester.cpp new file mode 100644 index 0000000..43314e1 --- /dev/null +++ b/Tests/QtAutogen/resourcetester.cpp @@ -0,0 +1,21 @@ + +#include "resourcetester.h" + +#include <QDebug> +#include <QApplication> +#include <QFile> +#include <QTimer> + +ResourceTester::ResourceTester(QObject *parent) + : QObject(parent) +{ + +} + +void ResourceTester::doTest() +{ + if (!QFile::exists(":/CMakeLists.txt")) + qApp->exit(EXIT_FAILURE); + + QTimer::singleShot(0, qApp, SLOT(quit())); +} diff --git a/Tests/QtAutogen/resourcetester.h b/Tests/QtAutogen/resourcetester.h new file mode 100644 index 0000000..b02cb4e --- /dev/null +++ b/Tests/QtAutogen/resourcetester.h @@ -0,0 +1,17 @@ + +#ifndef RESOURCE_TESTER_H +#define RESOURCE_TESTER_H + +#include <QObject> + +class ResourceTester : public QObject +{ + Q_OBJECT +public: + explicit ResourceTester(QObject *parent = 0); + +private slots: + void doTest(); +}; + +#endif diff --git a/Tests/QtAutomoc/sub/bar.h b/Tests/QtAutogen/sub/bar.h index db56b8e..db56b8e 100644 --- a/Tests/QtAutomoc/sub/bar.h +++ b/Tests/QtAutogen/sub/bar.h diff --git a/Tests/QtAutogen/test.qrc b/Tests/QtAutogen/test.qrc new file mode 100644 index 0000000..c3d4e3c --- /dev/null +++ b/Tests/QtAutogen/test.qrc @@ -0,0 +1,5 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource> + <file>CMakeLists.txt</file> +</qresource> +</RCC> diff --git a/Tests/QtAutomoc/xyz.cpp b/Tests/QtAutogen/xyz.cpp index a3562a3..a3562a3 100644 --- a/Tests/QtAutomoc/xyz.cpp +++ b/Tests/QtAutogen/xyz.cpp diff --git a/Tests/QtAutomoc/xyz.h b/Tests/QtAutogen/xyz.h index 8175d37..8175d37 100644 --- a/Tests/QtAutomoc/xyz.h +++ b/Tests/QtAutogen/xyz.h diff --git a/Tests/QtAutomoc/yaf.cpp b/Tests/QtAutogen/yaf.cpp index d278ab4..d278ab4 100644 --- a/Tests/QtAutomoc/yaf.cpp +++ b/Tests/QtAutogen/yaf.cpp diff --git a/Tests/QtAutomoc/yaf.h b/Tests/QtAutogen/yaf.h index 8689f83..8689f83 100644 --- a/Tests/QtAutomoc/yaf.h +++ b/Tests/QtAutogen/yaf.h diff --git a/Tests/QtAutomoc/yaf_p.h b/Tests/QtAutogen/yaf_p.h index f0368ad..f0368ad 100644 --- a/Tests/QtAutomoc/yaf_p.h +++ b/Tests/QtAutogen/yaf_p.h diff --git a/Tests/RunCMake/Syntax/ParenNoSpace-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-exe-stderr.txt index 10f3293..10f3293 100644 --- a/Tests/RunCMake/Syntax/ParenNoSpace-stderr.txt +++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-exe-stderr.txt diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-exe.cmake b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-exe.cmake new file mode 100644 index 0000000..b0268c8 --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-exe.cmake @@ -0,0 +1,7 @@ +enable_language(CXX) + +add_library(testLib empty_vs6_1.cpp) +add_executable(testExe empty_vs6_2.cpp) +target_link_libraries(testExe testLib) + +export(TARGETS testExe FILE "${CMAKE_CURRENT_BINARY_DIR}/cmp0022NOWARN-exe.cmake") diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared.cmake b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared.cmake new file mode 100644 index 0000000..2e76ee0 --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared.cmake @@ -0,0 +1,10 @@ +enable_language(CXX) + +cmake_policy(SET CMP0042 NEW) + +add_library(foo SHARED empty_vs6_1.cpp) +add_library(bar SHARED empty_vs6_2.cpp) +target_link_libraries(bar foo) + +add_executable(zot empty.cpp) +target_link_libraries(zot bar) diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW.cmake b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW.cmake new file mode 100644 index 0000000..3fee15d --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW.cmake @@ -0,0 +1,14 @@ + +project(CMP0022-NOWARN-static-NEW) + +cmake_policy(SET CMP0022 NEW) + +add_library(foo STATIC empty_vs6_1.cpp) +add_library(bar STATIC empty_vs6_2.cpp) +add_library(bat STATIC empty_vs6_3.cpp) +target_link_libraries(foo bar) +# The last element here needs to contain a space so that it is a single +# element which is not a valid target name. As bar is a STATIC library, +# this tests that the LINK_ONLY generator expression is not used for +# that element, creating an error. +target_link_libraries(bar LINK_PRIVATE bat "-lz -lm") diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-result.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-stderr.txt new file mode 100644 index 0000000..6a6a0c7 --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-stderr.txt @@ -0,0 +1,19 @@ +CMake Warning \(dev\) in CMakeLists.txt: + Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link + interface. Run "cmake --help-policy CMP0022" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + Target "bar" has an INTERFACE_LINK_LIBRARIES property. This should be + preferred as the source of the link interface for this library but because + CMP0022 is not set CMake is ignoring the property and using the link + implementation as the link interface instead. + + INTERFACE_LINK_LIBRARIES: + + foo + + Link implementation: + + \(empty\) + +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old.cmake b/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old.cmake new file mode 100644 index 0000000..c5d3c29 --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old.cmake @@ -0,0 +1,10 @@ + +project(CMP0022-WARN-empty-old) + +add_library(foo SHARED empty_vs6_1.cpp) +add_library(bar SHARED empty_vs6_2.cpp) + +set_property(TARGET bar PROPERTY INTERFACE_LINK_LIBRARIES foo) + +add_library(user empty.cpp) +target_link_libraries(user bar) diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-static-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-static-stderr.txt index 41d132c..1370c5e 100644 --- a/Tests/RunCMake/CMP0022/CMP0022-WARN-static-stderr.txt +++ b/Tests/RunCMake/CMP0022/CMP0022-WARN-static-stderr.txt @@ -3,8 +3,17 @@ CMake Warning \(dev\) in CMakeLists.txt: interface. Run "cmake --help-policy CMP0022" for policy details. Use the cmake_policy command to set the policy and suppress this warning. - Static library target "bar" has a INTERFACE_LINK_LIBRARIES property. This - should be preferred as the source of the link interface for this library. - Ignoring the property and using the link implementation as the link - interface instead. + Target "bar" has an INTERFACE_LINK_LIBRARIES property. This should be + preferred as the source of the link interface for this library but because + CMP0022 is not set CMake is ignoring the property and using the link + implementation as the link interface instead. + + INTERFACE_LINK_LIBRARIES: + + foo + + Link implementation: + + bat + This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-stderr.txt index 93c0ab3..2f7dfbf 100644 --- a/Tests/RunCMake/CMP0022/CMP0022-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0022/CMP0022-WARN-stderr.txt @@ -1,10 +1,10 @@ -CMake Warning \(dev\) in CMakeLists.txt: +^CMake Warning \(dev\) in CMakeLists.txt: Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link interface. Run "cmake --help-policy CMP0022" for policy details. Use the cmake_policy command to set the policy and suppress this warning. - Target "bar" has a INTERFACE_LINK_LIBRARIES property which differs from its - LINK_INTERFACE_LIBRARIES properties. + Target "bar" has an INTERFACE_LINK_LIBRARIES property which differs from + its LINK_INTERFACE_LIBRARIES properties. INTERFACE_LINK_LIBRARIES: diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-stderr.txt index 6370b24..f672285 100644 --- a/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-stderr.txt +++ b/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-stderr.txt @@ -3,8 +3,8 @@ CMake Warning \(dev\) in CMakeLists.txt: interface. Run "cmake --help-policy CMP0022" for policy details. Use the cmake_policy command to set the policy and suppress this warning. - Target "bar" has a INTERFACE_LINK_LIBRARIES property which differs from its - LINK_INTERFACE_LIBRARIES properties. + Target "bar" has an INTERFACE_LINK_LIBRARIES property which differs from + its LINK_INTERFACE_LIBRARIES properties. INTERFACE_LINK_LIBRARIES: diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN.cmake b/Tests/RunCMake/CMP0022/CMP0022-WARN.cmake index 24b7f45..e3552b2 100644 --- a/Tests/RunCMake/CMP0022/CMP0022-WARN.cmake +++ b/Tests/RunCMake/CMP0022/CMP0022-WARN.cmake @@ -1,6 +1,8 @@ project(CMP0022-WARN) +cmake_policy(SET CMP0042 NEW) + add_library(foo SHARED empty_vs6_1.cpp) add_library(bar SHARED empty_vs6_2.cpp) add_library(bat SHARED empty_vs6_3.cpp) @@ -9,3 +11,8 @@ set_property(TARGET bar PROPERTY LINK_INTERFACE_LIBRARIES bat) add_library(user empty.cpp) target_link_libraries(user bar) + +# Use "bar" again with a different "head" target to check +# that the warning does not appear again. +add_library(user2 empty_vs6_3.cpp) +target_link_libraries(user2 bar) diff --git a/Tests/RunCMake/CMP0022/CMP0022-export-exe-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-export-exe-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-export-exe-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0022/CMP0022-export-exe.cmake b/Tests/RunCMake/CMP0022/CMP0022-export-exe.cmake new file mode 100644 index 0000000..d832fac --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-export-exe.cmake @@ -0,0 +1,9 @@ +enable_language(CXX) + +cmake_policy(SET CMP0022 NEW) + +add_library(testLib empty_vs6_1.cpp) +add_executable(testExe empty_vs6_2.cpp) +target_link_libraries(testExe testLib) + +export(TARGETS testExe FILE "${CMAKE_CURRENT_BINARY_DIR}/cmp0022NEW-exe.cmake") diff --git a/Tests/RunCMake/CMP0022/CMP0022-export-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-export-stderr.txt index ae7627e..405dd8d 100644 --- a/Tests/RunCMake/CMP0022/CMP0022-export-stderr.txt +++ b/Tests/RunCMake/CMP0022/CMP0022-export-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at CMP0022-export.cmake:11 \(export\): +CMake Error in CMakeLists.txt: Target "cmp0022NEW" has policy CMP0022 enabled, but also has old-style LINK_INTERFACE_LIBRARIES properties populated, but it was exported without the EXPORT_LINK_INTERFACE_LIBRARIES to export the old-style properties diff --git a/Tests/RunCMake/CMP0022/RunCMakeTest.cmake b/Tests/RunCMake/CMP0022/RunCMakeTest.cmake index dcef0f5..4c10996 100644 --- a/Tests/RunCMake/CMP0022/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMP0022/RunCMakeTest.cmake @@ -3,7 +3,12 @@ include(RunCMake) run_cmake(CMP0022-WARN) run_cmake(CMP0022-WARN-tll) run_cmake(CMP0022-WARN-static) +run_cmake(CMP0022-WARN-empty-old) +run_cmake(CMP0022-NOWARN-exe) +run_cmake(CMP0022-NOWARN-shared) run_cmake(CMP0022-NOWARN-static) +run_cmake(CMP0022-NOWARN-static-NEW) run_cmake(CMP0022-NOWARN-static-link_libraries) run_cmake(CMP0022-export) +run_cmake(CMP0022-export-exe) run_cmake(CMP0022-install-export) diff --git a/Tests/RunCMake/CMP0022/empty_vs6_4.cpp b/Tests/RunCMake/CMP0022/empty_vs6_4.cpp new file mode 100644 index 0000000..7efedab --- /dev/null +++ b/Tests/RunCMake/CMP0022/empty_vs6_4.cpp @@ -0,0 +1 @@ +#include "empty.cpp" diff --git a/Tests/RunCMake/CMP0026/CMP0026-IMPORTED-result.txt b/Tests/RunCMake/CMP0026/CMP0026-IMPORTED-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0026/CMP0026-IMPORTED-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0026/CMP0026-IMPORTED-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-IMPORTED-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0026/CMP0026-IMPORTED-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0026/CMP0026-IMPORTED.cmake b/Tests/RunCMake/CMP0026/CMP0026-IMPORTED.cmake new file mode 100644 index 0000000..650c8a5 --- /dev/null +++ b/Tests/RunCMake/CMP0026/CMP0026-IMPORTED.cmake @@ -0,0 +1,6 @@ + +enable_language(CXX) + +add_library(someimportedlib SHARED IMPORTED) + +get_target_property(_loc someimportedlib LOCATION) diff --git a/Tests/RunCMake/build_command/BeforeProject-result.txt b/Tests/RunCMake/CMP0026/CMP0026-NEW-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/build_command/BeforeProject-result.txt +++ b/Tests/RunCMake/CMP0026/CMP0026-NEW-result.txt diff --git a/Tests/RunCMake/CMP0026/CMP0026-NEW-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-NEW-stderr.txt new file mode 100644 index 0000000..2a05a4d --- /dev/null +++ b/Tests/RunCMake/CMP0026/CMP0026-NEW-stderr.txt @@ -0,0 +1,11 @@ +CMake Error at CMP0026-NEW.cmake:7 \(get_target_property\): + Policy CMP0026 is not set: Disallow use of the LOCATION target property. + Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. + + The LOCATION property may not be read from target "somelib". Use the + target name directly with add_custom_command, or use the generator + expression \$<TARGET_FILE>, as appropriate. + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CMP0026/CMP0026-NEW.cmake b/Tests/RunCMake/CMP0026/CMP0026-NEW.cmake new file mode 100644 index 0000000..1659ffc --- /dev/null +++ b/Tests/RunCMake/CMP0026/CMP0026-NEW.cmake @@ -0,0 +1,7 @@ + +enable_language(CXX) + +cmake_policy(SET CMP0026 NEW) + +add_library(somelib empty.cpp) +get_target_property(_loc somelib LOCATION) diff --git a/Tests/RunCMake/CMP0026/CMP0026-WARN-result.txt b/Tests/RunCMake/CMP0026/CMP0026-WARN-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0026/CMP0026-WARN-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt new file mode 100644 index 0000000..9b88194 --- /dev/null +++ b/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt @@ -0,0 +1,12 @@ +CMake Warning \(dev\) at CMP0026-WARN.cmake:5 \(get_target_property\): + Policy CMP0026 is not set: Disallow use of the LOCATION target property. + Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. + + The LOCATION property should not be read from target "somelib". Use the + target name directly with add_custom_command, or use the generator + expression \$<TARGET_FILE>, as appropriate. + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0026/CMP0026-WARN.cmake b/Tests/RunCMake/CMP0026/CMP0026-WARN.cmake new file mode 100644 index 0000000..89c5a8a --- /dev/null +++ b/Tests/RunCMake/CMP0026/CMP0026-WARN.cmake @@ -0,0 +1,5 @@ + +enable_language(CXX) + +add_library(somelib empty.cpp) +get_target_property(_loc somelib LOCATION) diff --git a/Tests/RunCMake/CMP0026/CMakeLists.txt b/Tests/RunCMake/CMP0026/CMakeLists.txt new file mode 100644 index 0000000..12cd3c7 --- /dev/null +++ b/Tests/RunCMake/CMP0026/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.4) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0026/RunCMakeTest.cmake b/Tests/RunCMake/CMP0026/RunCMakeTest.cmake new file mode 100644 index 0000000..68000a6 --- /dev/null +++ b/Tests/RunCMake/CMP0026/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(CMP0026-WARN) +run_cmake(CMP0026-NEW) +run_cmake(CMP0026-IMPORTED) diff --git a/Tests/RunCMake/CMP0026/empty.cpp b/Tests/RunCMake/CMP0026/empty.cpp new file mode 100644 index 0000000..bfbbdde --- /dev/null +++ b/Tests/RunCMake/CMP0026/empty.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/CMP0027/CMP0027-NEW-result.txt b/Tests/RunCMake/CMP0027/CMP0027-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0027/CMP0027-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0027/CMP0027-NEW-stderr.txt b/Tests/RunCMake/CMP0027/CMP0027-NEW-stderr.txt new file mode 100644 index 0000000..5948ec8 --- /dev/null +++ b/Tests/RunCMake/CMP0027/CMP0027-NEW-stderr.txt @@ -0,0 +1,13 @@ +CMake Error in CMakeLists.txt: + Imported target "testTarget" includes non-existent path + + "/does/not/exist" + + in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include: + + \* The path was deleted, renamed, or moved to another location. + + \* An install or uninstall procedure did not complete successfully. + + \* The installation package was faulty and references files it does not + provide. diff --git a/Tests/RunCMake/CMP0027/CMP0027-NEW.cmake b/Tests/RunCMake/CMP0027/CMP0027-NEW.cmake new file mode 100644 index 0000000..8245085 --- /dev/null +++ b/Tests/RunCMake/CMP0027/CMP0027-NEW.cmake @@ -0,0 +1,10 @@ + +enable_language(CXX) + +cmake_policy(SET CMP0027 NEW) + +add_library(testTarget UNKNOWN IMPORTED) +set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "/does/not/exist") + +add_library(userTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") +target_link_libraries(userTarget PRIVATE $<1:testTarget>) diff --git a/Tests/RunCMake/CMP0027/CMP0027-OLD-result.txt b/Tests/RunCMake/CMP0027/CMP0027-OLD-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0027/CMP0027-OLD-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0027/CMP0027-OLD-stderr.txt b/Tests/RunCMake/CMP0027/CMP0027-OLD-stderr.txt new file mode 100644 index 0000000..4c2b300 --- /dev/null +++ b/Tests/RunCMake/CMP0027/CMP0027-OLD-stderr.txt @@ -0,0 +1,13 @@ +CMake Warning \(dev\) in CMakeLists.txt: + Imported target "testTarget" includes non-existent path + + "/does/not/exist" + + in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include: + + \* The path was deleted, renamed, or moved to another location. + + \* An install or uninstall procedure did not complete successfully. + + \* The installation package was faulty and references files it does not + provide. diff --git a/Tests/RunCMake/CMP0027/CMP0027-OLD.cmake b/Tests/RunCMake/CMP0027/CMP0027-OLD.cmake new file mode 100644 index 0000000..404217d --- /dev/null +++ b/Tests/RunCMake/CMP0027/CMP0027-OLD.cmake @@ -0,0 +1,10 @@ + +enable_language(CXX) + +cmake_policy(SET CMP0027 OLD) + +add_library(testTarget UNKNOWN IMPORTED) +set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "/does/not/exist") + +add_library(userTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") +target_link_libraries(userTarget PRIVATE $<1:testTarget>) diff --git a/Tests/RunCMake/CMP0027/CMP0027-WARN-result.txt b/Tests/RunCMake/CMP0027/CMP0027-WARN-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0027/CMP0027-WARN-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0027/CMP0027-WARN-stderr.txt b/Tests/RunCMake/CMP0027/CMP0027-WARN-stderr.txt new file mode 100644 index 0000000..9bcec3c --- /dev/null +++ b/Tests/RunCMake/CMP0027/CMP0027-WARN-stderr.txt @@ -0,0 +1,18 @@ +CMake Warning \(dev\) in CMakeLists.txt: + Policy CMP0027 is not set: Conditionally linked imported targets with + missing include directories. Run "cmake --help-policy CMP0027" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + Imported target "testTarget" includes non-existent path + + "/does/not/exist" + + in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include: + + \* The path was deleted, renamed, or moved to another location. + + \* An install or uninstall procedure did not complete successfully. + + \* The installation package was faulty and references files it does not + provide. diff --git a/Tests/RunCMake/CMP0027/CMP0027-WARN.cmake b/Tests/RunCMake/CMP0027/CMP0027-WARN.cmake new file mode 100644 index 0000000..8e5f9b5 --- /dev/null +++ b/Tests/RunCMake/CMP0027/CMP0027-WARN.cmake @@ -0,0 +1,8 @@ + +enable_language(CXX) + +add_library(testTarget UNKNOWN IMPORTED) +set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "/does/not/exist") + +add_library(userTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") +target_link_libraries(userTarget PRIVATE $<1:testTarget>) diff --git a/Tests/RunCMake/CMP0027/CMakeLists.txt b/Tests/RunCMake/CMP0027/CMakeLists.txt new file mode 100644 index 0000000..8f85fbf --- /dev/null +++ b/Tests/RunCMake/CMP0027/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.4) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/CMP0027/RunCMakeTest.cmake b/Tests/RunCMake/CMP0027/RunCMakeTest.cmake new file mode 100644 index 0000000..1017f01 --- /dev/null +++ b/Tests/RunCMake/CMP0027/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(CMP0027-NEW) +run_cmake(CMP0027-OLD) +run_cmake(CMP0027-WARN) diff --git a/Tests/RunCMake/CMP0027/empty.cpp b/Tests/RunCMake/CMP0027/empty.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CMP0027/empty.cpp diff --git a/Tests/RunCMake/CMP0028/CMP0028-NEW-result.txt b/Tests/RunCMake/CMP0028/CMP0028-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0028/CMP0028-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0028/CMP0028-NEW-stderr.txt b/Tests/RunCMake/CMP0028/CMP0028-NEW-stderr.txt new file mode 100644 index 0000000..711ad0e --- /dev/null +++ b/Tests/RunCMake/CMP0028/CMP0028-NEW-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at CMP0028-NEW.cmake:4 \(add_library\): + Target "foo" links to target "External::Library" but the target was not + found. Perhaps a find_package\(\) call is missing for an IMPORTED target, or + an ALIAS target is missing\? +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CMP0028/CMP0028-NEW.cmake b/Tests/RunCMake/CMP0028/CMP0028-NEW.cmake new file mode 100644 index 0000000..a0a6ae8 --- /dev/null +++ b/Tests/RunCMake/CMP0028/CMP0028-NEW.cmake @@ -0,0 +1,5 @@ + +cmake_policy(SET CMP0028 NEW) + +add_library(foo empty.cpp) +target_link_libraries(foo PRIVATE External::Library) diff --git a/Tests/RunCMake/CMP0028/CMP0028-OLD-result.txt b/Tests/RunCMake/CMP0028/CMP0028-OLD-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0028/CMP0028-OLD-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0028/CMP0028-OLD-stderr.txt b/Tests/RunCMake/CMP0028/CMP0028-OLD-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0028/CMP0028-OLD-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0028/CMP0028-OLD.cmake b/Tests/RunCMake/CMP0028/CMP0028-OLD.cmake new file mode 100644 index 0000000..d4a870b --- /dev/null +++ b/Tests/RunCMake/CMP0028/CMP0028-OLD.cmake @@ -0,0 +1,5 @@ + +cmake_policy(SET CMP0028 OLD) + +add_library(foo empty.cpp) +target_link_libraries(foo PRIVATE External::Library) diff --git a/Tests/RunCMake/CMP0028/CMP0028-WARN-result.txt b/Tests/RunCMake/CMP0028/CMP0028-WARN-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0028/CMP0028-WARN-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0028/CMP0028-WARN-stderr.txt b/Tests/RunCMake/CMP0028/CMP0028-WARN-stderr.txt new file mode 100644 index 0000000..41d7560 --- /dev/null +++ b/Tests/RunCMake/CMP0028/CMP0028-WARN-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) at CMP0028-WARN.cmake:2 \(add_library\): + Policy CMP0028 is not set: Double colon in target name means ALIAS or + IMPORTED target. Run "cmake --help-policy CMP0028" for policy details. + Use the cmake_policy command to set the policy and suppress this warning. + + Target "foo" links to target "External::Library" but the target was not + found. Perhaps a find_package\(\) call is missing for an IMPORTED target, or + an ALIAS target is missing\? +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0028/CMP0028-WARN.cmake b/Tests/RunCMake/CMP0028/CMP0028-WARN.cmake new file mode 100644 index 0000000..70a6cc6 --- /dev/null +++ b/Tests/RunCMake/CMP0028/CMP0028-WARN.cmake @@ -0,0 +1,3 @@ + +add_library(foo empty.cpp) +target_link_libraries(foo PRIVATE External::Library) diff --git a/Tests/RunCMake/CMP0028/CMakeLists.txt b/Tests/RunCMake/CMP0028/CMakeLists.txt new file mode 100644 index 0000000..f1d9cae --- /dev/null +++ b/Tests/RunCMake/CMP0028/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.4) +project(${RunCMake_TEST} CXX) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/CMP0028/RunCMakeTest.cmake b/Tests/RunCMake/CMP0028/RunCMakeTest.cmake new file mode 100644 index 0000000..293e27b --- /dev/null +++ b/Tests/RunCMake/CMP0028/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(CMP0028-NEW) +run_cmake(CMP0028-OLD) +run_cmake(CMP0028-WARN) diff --git a/Tests/RunCMake/CMP0028/empty.cpp b/Tests/RunCMake/CMP0028/empty.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CMP0028/empty.cpp diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-colon-result.txt b/Tests/RunCMake/CMP0037/CMP0037-NEW-colon-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-colon-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-colon-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-NEW-colon-stderr.txt new file mode 100644 index 0000000..9d2c35b --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-colon-stderr.txt @@ -0,0 +1,35 @@ +CMake Error at CMP0037-NEW-colon.cmake:4 \(add_library\): + Policy CMP0037 is not set: Target names should not be reserved and should + match a validity pattern. Run "cmake --help-policy CMP0037" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + The target name "lib:colon" is reserved or not valid for certain CMake + features, such as generator expressions, and may result in undefined + behavior. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at CMP0037-NEW-colon.cmake:5 \(add_executable\): + Policy CMP0037 is not set: Target names should not be reserved and should + match a validity pattern. Run "cmake --help-policy CMP0037" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + The target name "exe:colon" is reserved or not valid for certain CMake + features, such as generator expressions, and may result in undefined + behavior. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at CMP0037-NEW-colon.cmake:6 \(add_custom_target\): + Policy CMP0037 is not set: Target names should not be reserved and should + match a validity pattern. Run "cmake --help-policy CMP0037" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + The target name "custom:colon" is reserved or not valid for certain CMake + features, such as generator expressions, and may result in undefined + behavior. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-colon.cmake b/Tests/RunCMake/CMP0037/CMP0037-NEW-colon.cmake new file mode 100644 index 0000000..f4c070d --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-colon.cmake @@ -0,0 +1,6 @@ + +cmake_policy(SET CMP0037 NEW) + +add_library("lib:colon" empty.cpp) +add_executable("exe:colon" empty.cpp) +add_custom_target("custom:colon") diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved-result.txt b/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved-stderr.txt new file mode 100644 index 0000000..13835af --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved-stderr.txt @@ -0,0 +1,33 @@ +CMake Error at CMP0037-NEW-reserved.cmake:4 \(add_library\): + Policy CMP0037 is not set: Target names should not be reserved and should + match a validity pattern. Run "cmake --help-policy CMP0037" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + The target name "all" is reserved or not valid for certain CMake features, + such as generator expressions, and may result in undefined behavior. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at CMP0037-NEW-reserved.cmake:5 \(add_executable\): + Policy CMP0037 is not set: Target names should not be reserved and should + match a validity pattern. Run "cmake --help-policy CMP0037" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + The target name "clean" is reserved or not valid for certain CMake + features, such as generator expressions, and may result in undefined + behavior. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at CMP0037-NEW-reserved.cmake:6 \(add_custom_target\): + Policy CMP0037 is not set: Target names should not be reserved and should + match a validity pattern. Run "cmake --help-policy CMP0037" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + The target name "help" is reserved or not valid for certain CMake features, + such as generator expressions, and may result in undefined behavior. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved.cmake b/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved.cmake new file mode 100644 index 0000000..e9f6404 --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved.cmake @@ -0,0 +1,6 @@ + +cmake_policy(SET CMP0037 NEW) + +add_library(all empty.cpp) +add_executable(clean empty.cpp) +add_custom_target(help) diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-space-result.txt b/Tests/RunCMake/CMP0037/CMP0037-NEW-space-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-space-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-space-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-NEW-space-stderr.txt new file mode 100644 index 0000000..2525bcd --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-space-stderr.txt @@ -0,0 +1,35 @@ +CMake Error at CMP0037-NEW-space.cmake:4 \(add_library\): + Policy CMP0037 is not set: Target names should not be reserved and should + match a validity pattern. Run "cmake --help-policy CMP0037" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + The target name "lib with spaces" is reserved or not valid for certain + CMake features, such as generator expressions, and may result in undefined + behavior. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at CMP0037-NEW-space.cmake:5 \(add_executable\): + Policy CMP0037 is not set: Target names should not be reserved and should + match a validity pattern. Run "cmake --help-policy CMP0037" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + The target name "exe with spaces" is reserved or not valid for certain + CMake features, such as generator expressions, and may result in undefined + behavior. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at CMP0037-NEW-space.cmake:6 \(add_custom_target\): + Policy CMP0037 is not set: Target names should not be reserved and should + match a validity pattern. Run "cmake --help-policy CMP0037" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + The target name "custom with spaces" is reserved or not valid for certain + CMake features, such as generator expressions, and may result in undefined + behavior. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-space.cmake b/Tests/RunCMake/CMP0037/CMP0037-NEW-space.cmake new file mode 100644 index 0000000..9227986 --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-space.cmake @@ -0,0 +1,6 @@ + +cmake_policy(SET CMP0037 NEW) + +add_library("lib with spaces" empty.cpp) +add_executable("exe with spaces" empty.cpp) +add_custom_target("custom with spaces") diff --git a/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved-result.txt b/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved.cmake b/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved.cmake new file mode 100644 index 0000000..870a286 --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved.cmake @@ -0,0 +1,6 @@ + +cmake_policy(SET CMP0037 OLD) + +add_library(all empty.cpp) +add_executable(clean empty.cpp) +add_custom_target(help) diff --git a/Tests/RunCMake/CMP0037/CMP0037-OLD-space-result.txt b/Tests/RunCMake/CMP0037/CMP0037-OLD-space-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-OLD-space-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0037/CMP0037-OLD-space-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-OLD-space-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-OLD-space-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0037/CMP0037-OLD-space.cmake b/Tests/RunCMake/CMP0037/CMP0037-OLD-space.cmake new file mode 100644 index 0000000..46193a1 --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-OLD-space.cmake @@ -0,0 +1,6 @@ + +cmake_policy(SET CMP0037 OLD) + +add_library("lib with spaces" empty.cpp) +add_executable("exe with spaces" empty.cpp) +add_custom_target("custom with spaces") diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-colon-result.txt b/Tests/RunCMake/CMP0037/CMP0037-WARN-colon-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-WARN-colon-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-colon-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-WARN-colon-stderr.txt new file mode 100644 index 0000000..d3b0e17 --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-WARN-colon-stderr.txt @@ -0,0 +1,38 @@ +CMake Warning \(dev\) at CMP0037-WARN-colon.cmake:2 \(add_library\): + Policy CMP0037 is not set: Target names should not be reserved and should + match a validity pattern. Run "cmake --help-policy CMP0037" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + The target name "lib:colon" is reserved or not valid for certain CMake + features, such as generator expressions, and may result in undefined + behavior. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at CMP0037-WARN-colon.cmake:3 \(add_executable\): + Policy CMP0037 is not set: Target names should not be reserved and should + match a validity pattern. Run "cmake --help-policy CMP0037" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + The target name "exe:colon" is reserved or not valid for certain CMake + features, such as generator expressions, and may result in undefined + behavior. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at CMP0037-WARN-colon.cmake:4 \(add_custom_target\): + Policy CMP0037 is not set: Target names should not be reserved and should + match a validity pattern. Run "cmake --help-policy CMP0037" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + The target name "custom:colon" is reserved or not valid for certain CMake + features, such as generator expressions, and may result in undefined + behavior. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-colon.cmake b/Tests/RunCMake/CMP0037/CMP0037-WARN-colon.cmake new file mode 100644 index 0000000..445e3b2 --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-WARN-colon.cmake @@ -0,0 +1,4 @@ + +add_library("lib:colon" empty.cpp) +add_executable("exe:colon" empty.cpp) +add_custom_target("custom:colon") diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-space-result.txt b/Tests/RunCMake/CMP0037/CMP0037-WARN-space-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-WARN-space-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-space-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-WARN-space-stderr.txt new file mode 100644 index 0000000..e39477a --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-WARN-space-stderr.txt @@ -0,0 +1,37 @@ +CMake Warning \(dev\) at CMP0037-WARN-space.cmake:2 \(add_library\): + Policy CMP0037 is not set: Target names should not be reserved and should + match a validity pattern. Run "cmake --help-policy CMP0037" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + The target name "lib with spaces" is reserved or not valid for certain + CMake features, such as generator expressions, and may result in undefined + behavior. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at CMP0037-WARN-space.cmake:3 \(add_executable\): + Policy CMP0037 is not set: Target names should not be reserved and should + match a validity pattern. Run "cmake --help-policy CMP0037" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + The target name "exe with spaces" is reserved or not valid for certain + CMake features, such as generator expressions, and may result in undefined + behavior. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at CMP0037-WARN-space.cmake:4 \(add_custom_target\): + Policy CMP0037 is not set: Target names should not be reserved and should + match a validity pattern. Run "cmake --help-policy CMP0037" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + The target name "custom with spaces" is reserved or not valid for certain + CMake features, such as generator expressions, and may result in undefined + behavior. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-space.cmake b/Tests/RunCMake/CMP0037/CMP0037-WARN-space.cmake new file mode 100644 index 0000000..e50a64d --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-WARN-space.cmake @@ -0,0 +1,4 @@ + +add_library("lib with spaces" empty.cpp) +add_executable("exe with spaces" empty.cpp) +add_custom_target("custom with spaces") diff --git a/Tests/RunCMake/CMP0037/CMakeLists.txt b/Tests/RunCMake/CMP0037/CMakeLists.txt new file mode 100644 index 0000000..f1d9cae --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.4) +project(${RunCMake_TEST} CXX) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/CMP0037/RunCMakeTest.cmake b/Tests/RunCMake/CMP0037/RunCMakeTest.cmake new file mode 100644 index 0000000..b7d8d7b --- /dev/null +++ b/Tests/RunCMake/CMP0037/RunCMakeTest.cmake @@ -0,0 +1,13 @@ +include(RunCMake) + +run_cmake(CMP0037-OLD-space) +run_cmake(CMP0037-NEW-space) +run_cmake(CMP0037-WARN-space) +run_cmake(CMP0037-NEW-colon) + +if(NOT (WIN32 AND "${RunCMake_GENERATOR}" MATCHES "Make")) + run_cmake(CMP0037-WARN-colon) +endif() + +run_cmake(CMP0037-OLD-reserved) +run_cmake(CMP0037-NEW-reserved) diff --git a/Tests/RunCMake/CMP0037/empty.cpp b/Tests/RunCMake/CMP0037/empty.cpp new file mode 100644 index 0000000..bfbbdde --- /dev/null +++ b/Tests/RunCMake/CMP0037/empty.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/CMP0038/CMP0038-NEW-result.txt b/Tests/RunCMake/CMP0038/CMP0038-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0038/CMP0038-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0038/CMP0038-NEW-stderr.txt b/Tests/RunCMake/CMP0038/CMP0038-NEW-stderr.txt new file mode 100644 index 0000000..3d0a428 --- /dev/null +++ b/Tests/RunCMake/CMP0038/CMP0038-NEW-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at CMP0038-NEW.cmake:3 \(add_library\): + Target "self_link" links to itself. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CMP0038/CMP0038-NEW.cmake b/Tests/RunCMake/CMP0038/CMP0038-NEW.cmake new file mode 100644 index 0000000..6296b83 --- /dev/null +++ b/Tests/RunCMake/CMP0038/CMP0038-NEW.cmake @@ -0,0 +1,4 @@ + +cmake_policy(SET CMP0038 NEW) +add_library(self_link empty.cpp) +target_link_libraries(self_link self_link) diff --git a/Tests/RunCMake/CMP0038/CMP0038-OLD-result.txt b/Tests/RunCMake/CMP0038/CMP0038-OLD-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0038/CMP0038-OLD-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0038/CMP0038-OLD-stderr.txt b/Tests/RunCMake/CMP0038/CMP0038-OLD-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0038/CMP0038-OLD-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0038/CMP0038-OLD.cmake b/Tests/RunCMake/CMP0038/CMP0038-OLD.cmake new file mode 100644 index 0000000..3752821 --- /dev/null +++ b/Tests/RunCMake/CMP0038/CMP0038-OLD.cmake @@ -0,0 +1,4 @@ + +cmake_policy(SET CMP0038 OLD) +add_library(self_link empty.cpp) +target_link_libraries(self_link self_link) diff --git a/Tests/RunCMake/CMP0038/CMP0038-WARN-result.txt b/Tests/RunCMake/CMP0038/CMP0038-WARN-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0038/CMP0038-WARN-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0038/CMP0038-WARN-stderr.txt b/Tests/RunCMake/CMP0038/CMP0038-WARN-stderr.txt new file mode 100644 index 0000000..64631e7 --- /dev/null +++ b/Tests/RunCMake/CMP0038/CMP0038-WARN-stderr.txt @@ -0,0 +1,9 @@ +CMake Warning \(dev\) at CMP0038-WARN.cmake:2 \(add_library\): + Policy CMP0038 is not set: Targets may not link directly to themselves. + Run "cmake --help-policy CMP0038" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. + + Target "self_link" links to itself. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0038/CMP0038-WARN.cmake b/Tests/RunCMake/CMP0038/CMP0038-WARN.cmake new file mode 100644 index 0000000..5b92d09 --- /dev/null +++ b/Tests/RunCMake/CMP0038/CMP0038-WARN.cmake @@ -0,0 +1,3 @@ + +add_library(self_link empty.cpp) +target_link_libraries(self_link self_link) diff --git a/Tests/RunCMake/CMP0038/CMakeLists.txt b/Tests/RunCMake/CMP0038/CMakeLists.txt new file mode 100644 index 0000000..2f10cb0 --- /dev/null +++ b/Tests/RunCMake/CMP0038/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.12) +project(${RunCMake_TEST} CXX) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/CMP0038/RunCMakeTest.cmake b/Tests/RunCMake/CMP0038/RunCMakeTest.cmake new file mode 100644 index 0000000..fc3500a --- /dev/null +++ b/Tests/RunCMake/CMP0038/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(CMP0038-WARN) +run_cmake(CMP0038-NEW) +run_cmake(CMP0038-OLD) diff --git a/Tests/RunCMake/CMP0038/empty.cpp b/Tests/RunCMake/CMP0038/empty.cpp new file mode 100644 index 0000000..bfbbdde --- /dev/null +++ b/Tests/RunCMake/CMP0038/empty.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/CMP0039/CMP0039-NEW-result.txt b/Tests/RunCMake/CMP0039/CMP0039-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0039/CMP0039-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0039/CMP0039-NEW-stderr.txt b/Tests/RunCMake/CMP0039/CMP0039-NEW-stderr.txt new file mode 100644 index 0000000..821c4f8 --- /dev/null +++ b/Tests/RunCMake/CMP0039/CMP0039-NEW-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at CMP0039-NEW.cmake:7 \(target_link_libraries\): + Policy CMP0039 is not set: Utility targets may not have link dependencies. + Run "cmake --help-policy CMP0039" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. + + Utility target "utility" must not be used as the target of a + target_link_libraries call. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CMP0039/CMP0039-NEW.cmake b/Tests/RunCMake/CMP0039/CMP0039-NEW.cmake new file mode 100644 index 0000000..2032d64 --- /dev/null +++ b/Tests/RunCMake/CMP0039/CMP0039-NEW.cmake @@ -0,0 +1,7 @@ + +cmake_policy(SET CMP0039 NEW) + +add_custom_target(utility + COMMAND ${CMAKE_COMMAND} -E echo test +) +target_link_libraries(utility m) diff --git a/Tests/RunCMake/CMP0039/CMP0039-OLD-result.txt b/Tests/RunCMake/CMP0039/CMP0039-OLD-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0039/CMP0039-OLD-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0039/CMP0039-OLD-stderr.txt b/Tests/RunCMake/CMP0039/CMP0039-OLD-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0039/CMP0039-OLD-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0039/CMP0039-OLD.cmake b/Tests/RunCMake/CMP0039/CMP0039-OLD.cmake new file mode 100644 index 0000000..9a513f4 --- /dev/null +++ b/Tests/RunCMake/CMP0039/CMP0039-OLD.cmake @@ -0,0 +1,7 @@ + +cmake_policy(SET CMP0039 OLD) + +add_custom_target(utility + COMMAND ${CMAKE_COMMAND} -E echo test +) +target_link_libraries(utility m) diff --git a/Tests/RunCMake/CMP0039/CMP0039-WARN-result.txt b/Tests/RunCMake/CMP0039/CMP0039-WARN-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0039/CMP0039-WARN-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0039/CMP0039-WARN-stderr.txt b/Tests/RunCMake/CMP0039/CMP0039-WARN-stderr.txt new file mode 100644 index 0000000..a8e6c70 --- /dev/null +++ b/Tests/RunCMake/CMP0039/CMP0039-WARN-stderr.txt @@ -0,0 +1,10 @@ +CMake Warning \(dev\) at CMP0039-WARN.cmake:5 \(target_link_libraries\): + Policy CMP0039 is not set: Utility targets may not have link dependencies. + Run "cmake --help-policy CMP0039" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. + + Utility target "utility" should not be used as the target of a + target_link_libraries call. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0039/CMP0039-WARN.cmake b/Tests/RunCMake/CMP0039/CMP0039-WARN.cmake new file mode 100644 index 0000000..6249993 --- /dev/null +++ b/Tests/RunCMake/CMP0039/CMP0039-WARN.cmake @@ -0,0 +1,5 @@ + +add_custom_target(utility + COMMAND ${CMAKE_COMMAND} -E echo test +) +target_link_libraries(utility m) diff --git a/Tests/RunCMake/CMP0039/CMakeLists.txt b/Tests/RunCMake/CMP0039/CMakeLists.txt new file mode 100644 index 0000000..2f10cb0 --- /dev/null +++ b/Tests/RunCMake/CMP0039/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.12) +project(${RunCMake_TEST} CXX) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/CMP0039/RunCMakeTest.cmake b/Tests/RunCMake/CMP0039/RunCMakeTest.cmake new file mode 100644 index 0000000..58e8ea9 --- /dev/null +++ b/Tests/RunCMake/CMP0039/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(CMP0039-WARN) +run_cmake(CMP0039-NEW) +run_cmake(CMP0039-OLD) diff --git a/Tests/RunCMake/CMP0040/CMP0040-NEW-existing-target-result.txt b/Tests/RunCMake/CMP0040/CMP0040-NEW-existing-target-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0040/CMP0040-NEW-existing-target-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0040/CMP0040-NEW-existing-target-stderr.txt b/Tests/RunCMake/CMP0040/CMP0040-NEW-existing-target-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0040/CMP0040-NEW-existing-target-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0040/CMP0040-NEW-existing-target.cmake b/Tests/RunCMake/CMP0040/CMP0040-NEW-existing-target.cmake new file mode 100644 index 0000000..f9c8afd --- /dev/null +++ b/Tests/RunCMake/CMP0040/CMP0040-NEW-existing-target.cmake @@ -0,0 +1,7 @@ +cmake_policy(SET CMP0040 NEW) + +add_library(foobar empty.cpp) + +add_custom_command(TARGET foobar PRE_BUILD + COMMAND "${CMAKE_COMMAND} -E echo hello world" +) diff --git a/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-result.txt b/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-stderr.txt b/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-stderr.txt new file mode 100644 index 0000000..03a0217 --- /dev/null +++ b/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at CMP0040-NEW-missing-target.cmake:3 \(add_custom_command\): + Policy CMP0040 is not set: The target in the TARGET signature of + add_custom_command\(\) must exist. Run "cmake --help-policy CMP0040" for + policy details. Use the cmake_policy command to set the policy and + suppress this warning. ++ + The target name "foobar" is unknown in this context. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target.cmake b/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target.cmake new file mode 100644 index 0000000..276863d --- /dev/null +++ b/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target.cmake @@ -0,0 +1,5 @@ +cmake_policy(SET CMP0040 NEW) + +add_custom_command(TARGET foobar PRE_BUILD + COMMAND "${CMAKE_COMMAND} -E hello world" +) diff --git a/Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target-result.txt b/Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target-stderr.txt b/Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target.cmake b/Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target.cmake new file mode 100644 index 0000000..d7ec50d --- /dev/null +++ b/Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target.cmake @@ -0,0 +1,7 @@ +cmake_policy(SET CMP0040 OLD) + +add_library(foobar empty.cpp) + +add_custom_command(TARGET foobar PRE_BUILD + COMMAND "${CMAKE_COMMAND} -E echo hello world" +) diff --git a/Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target-result.txt b/Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target-stderr.txt b/Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target.cmake b/Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target.cmake new file mode 100644 index 0000000..ef7a0f7 --- /dev/null +++ b/Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target.cmake @@ -0,0 +1,5 @@ +cmake_policy(SET CMP0040 OLD) + +add_custom_command(TARGET foobar PRE_BUILD + COMMAND "${CMAKE_COMMAND} -E echo hello world" +) diff --git a/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-result.txt b/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-stderr.txt b/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-stderr.txt new file mode 100644 index 0000000..e791f0a --- /dev/null +++ b/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-stderr.txt @@ -0,0 +1,10 @@ +CMake Warning \(dev\) at CMP0040-WARN-missing-target.cmake:2 \(add_custom_command\): + Policy CMP0040 is not set: The target in the TARGET signature of + add_custom_command\(\) must exist. Run "cmake --help-policy CMP0040" for + policy details. Use the cmake_policy command to set the policy and + suppress this warning. ++ + The target name "foobar" is unknown in this context. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target.cmake b/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target.cmake new file mode 100644 index 0000000..2c3e401 --- /dev/null +++ b/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target.cmake @@ -0,0 +1,4 @@ + +add_custom_command(TARGET foobar PRE_BUILD + COMMAND "${CMAKE_COMMAND} -E hello world" +) diff --git a/Tests/RunCMake/CMP0040/CMakeLists.txt b/Tests/RunCMake/CMP0040/CMakeLists.txt new file mode 100644 index 0000000..2f10cb0 --- /dev/null +++ b/Tests/RunCMake/CMP0040/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.12) +project(${RunCMake_TEST} CXX) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/CMP0040/RunCMakeTest.cmake b/Tests/RunCMake/CMP0040/RunCMakeTest.cmake new file mode 100644 index 0000000..13160e3 --- /dev/null +++ b/Tests/RunCMake/CMP0040/RunCMakeTest.cmake @@ -0,0 +1,8 @@ +include(RunCMake) + +run_cmake(CMP0040-OLD-missing-target) +run_cmake(CMP0040-NEW-missing-target) +run_cmake(CMP0040-WARN-missing-target) + +run_cmake(CMP0040-OLD-existing-target) +run_cmake(CMP0040-NEW-existing-target) diff --git a/Tests/RunCMake/CMP0040/empty.cpp b/Tests/RunCMake/CMP0040/empty.cpp new file mode 100644 index 0000000..bfbbdde --- /dev/null +++ b/Tests/RunCMake/CMP0040/empty.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/CMP0041/CMP0041-NEW-result.txt b/Tests/RunCMake/CMP0041/CMP0041-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0041/CMP0041-NEW-stderr.txt b/Tests/RunCMake/CMP0041/CMP0041-NEW-stderr.txt new file mode 100644 index 0000000..2ec3aef --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-NEW-stderr.txt @@ -0,0 +1,20 @@ +CMake Error in CMakeLists.txt: + Target "foo" INTERFACE_INCLUDE_DIRECTORIES property contains relative path: + + "include/\$<TARGET_PROPERTY:NAME>" + + +CMake Error in CMakeLists.txt: + Target "foo" INTERFACE_INCLUDE_DIRECTORIES property contains path: + + ".*/Tests/RunCMake/CMP0041/include/\$<TARGET_PROPERTY:NAME>" + + which is prefixed in the source directory. + + +CMake Error in CMakeLists.txt: + Target "foo" INTERFACE_INCLUDE_DIRECTORIES property contains path: + + ".*/Tests/RunCMake/CMP0041/CMP0041-NEW-build/include/\$<TARGET_PROPERTY:NAME>" + + which is prefixed in the build directory. diff --git a/Tests/RunCMake/CMP0041/CMP0041-NEW.cmake b/Tests/RunCMake/CMP0041/CMP0041-NEW.cmake new file mode 100644 index 0000000..605b79a --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-NEW.cmake @@ -0,0 +1,12 @@ + +cmake_policy(SET CMP0041 NEW) + +add_library(foo empty.cpp) +set_property(TARGET foo + PROPERTY INTERFACE_INCLUDE_DIRECTORIES + include/$<TARGET_PROPERTY:NAME> + ${CMAKE_CURRENT_SOURCE_DIR}/include/$<TARGET_PROPERTY:NAME> + ${CMAKE_CURRENT_BINARY_DIR}/include/$<TARGET_PROPERTY:NAME> +) +install(TARGETS foo EXPORT FooExport DESTINATION lib) +install(EXPORT FooExport DESTINATION lib/cmake) diff --git a/Tests/RunCMake/CMP0041/CMP0041-OLD-result.txt b/Tests/RunCMake/CMP0041/CMP0041-OLD-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-OLD-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0041/CMP0041-OLD-stderr.txt b/Tests/RunCMake/CMP0041/CMP0041-OLD-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-OLD-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0041/CMP0041-OLD.cmake b/Tests/RunCMake/CMP0041/CMP0041-OLD.cmake new file mode 100644 index 0000000..16cbced --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-OLD.cmake @@ -0,0 +1,12 @@ + +cmake_policy(SET CMP0041 OLD) + +add_library(foo empty.cpp) +set_property(TARGET foo + PROPERTY INTERFACE_INCLUDE_DIRECTORIES + include/$<TARGET_PROPERTY:NAME> + ${CMAKE_CURRENT_SOURCE_DIR}/include/$<TARGET_PROPERTY:NAME> + ${CMAKE_CURRENT_BINARY_DIR}/include/$<TARGET_PROPERTY:NAME> +) +install(TARGETS foo EXPORT FooExport DESTINATION lib) +install(EXPORT FooExport DESTINATION lib/cmake) diff --git a/Tests/RunCMake/CMP0041/CMP0041-WARN-result.txt b/Tests/RunCMake/CMP0041/CMP0041-WARN-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-WARN-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0041/CMP0041-WARN-stderr.txt b/Tests/RunCMake/CMP0041/CMP0041-WARN-stderr.txt new file mode 100644 index 0000000..a7d303e --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-WARN-stderr.txt @@ -0,0 +1,32 @@ +CMake Warning in CMakeLists.txt: + Policy CMP0041 is not set: Error on relative include with generator + expression. Run "cmake --help-policy CMP0041" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + Target "foo" INTERFACE_INCLUDE_DIRECTORIES property contains relative path: + + "include/\$<TARGET_PROPERTY:NAME>" + + +CMake Warning in CMakeLists.txt: + Policy CMP0041 is not set: Error on relative include with generator + expression. Run "cmake --help-policy CMP0041" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + Target "foo" INTERFACE_INCLUDE_DIRECTORIES property contains path: + + ".*/Tests/RunCMake/CMP0041/include/\$<TARGET_PROPERTY:NAME>" + + which is prefixed in the source directory. + + +CMake Warning in CMakeLists.txt: + Policy CMP0041 is not set: Error on relative include with generator + expression. Run "cmake --help-policy CMP0041" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + Target "foo" INTERFACE_INCLUDE_DIRECTORIES property contains path: + + ".*/Tests/RunCMake/CMP0041/CMP0041-WARN-build/include/\$<TARGET_PROPERTY:NAME>" + + which is prefixed in the build directory. diff --git a/Tests/RunCMake/CMP0041/CMP0041-WARN.cmake b/Tests/RunCMake/CMP0041/CMP0041-WARN.cmake new file mode 100644 index 0000000..873cbc7 --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-WARN.cmake @@ -0,0 +1,10 @@ + +add_library(foo empty.cpp) +set_property(TARGET foo + PROPERTY INTERFACE_INCLUDE_DIRECTORIES + include/$<TARGET_PROPERTY:NAME> + ${CMAKE_CURRENT_SOURCE_DIR}/include/$<TARGET_PROPERTY:NAME> + ${CMAKE_CURRENT_BINARY_DIR}/include/$<TARGET_PROPERTY:NAME> +) +install(TARGETS foo EXPORT FooExport DESTINATION lib) +install(EXPORT FooExport DESTINATION lib/cmake) diff --git a/Tests/RunCMake/CMP0041/CMP0041-tid-NEW-result.txt b/Tests/RunCMake/CMP0041/CMP0041-tid-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-tid-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0041/CMP0041-tid-NEW-stderr.txt b/Tests/RunCMake/CMP0041/CMP0041-tid-NEW-stderr.txt new file mode 100644 index 0000000..9b0a214 --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-tid-NEW-stderr.txt @@ -0,0 +1,22 @@ +CMake Error in CMakeLists.txt: + Target "foo" INTERFACE_INCLUDE_DIRECTORIES property contains path: + + ".*/Tests/RunCMake/CMP0041/include/\$<TARGET_PROPERTY:NAME>" + + which is prefixed in the source directory. + + +CMake Error in CMakeLists.txt: + Target "foo" INTERFACE_INCLUDE_DIRECTORIES property contains path: + + ".*/Tests/RunCMake/CMP0041/include/\$<TARGET_PROPERTY:NAME>" + + which is prefixed in the source directory. + + +CMake Error in CMakeLists.txt: + Target "foo" INTERFACE_INCLUDE_DIRECTORIES property contains path: + + ".*/Tests/RunCMake/CMP0041/CMP0041-tid-NEW-build/include/\$<TARGET_PROPERTY:NAME>" + + which is prefixed in the build directory. diff --git a/Tests/RunCMake/CMP0041/CMP0041-tid-NEW.cmake b/Tests/RunCMake/CMP0041/CMP0041-tid-NEW.cmake new file mode 100644 index 0000000..3005108 --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-tid-NEW.cmake @@ -0,0 +1,11 @@ + +cmake_policy(SET CMP0041 NEW) + +add_library(foo empty.cpp) +target_include_directories(foo INTERFACE + include/$<TARGET_PROPERTY:NAME> + ${CMAKE_CURRENT_SOURCE_DIR}/include/$<TARGET_PROPERTY:NAME> + ${CMAKE_CURRENT_BINARY_DIR}/include/$<TARGET_PROPERTY:NAME> +) +install(TARGETS foo EXPORT FooExport DESTINATION lib) +install(EXPORT FooExport DESTINATION lib/cmake) diff --git a/Tests/RunCMake/CMP0041/CMP0041-tid-OLD-result.txt b/Tests/RunCMake/CMP0041/CMP0041-tid-OLD-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-tid-OLD-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0041/CMP0041-tid-OLD-stderr.txt b/Tests/RunCMake/CMP0041/CMP0041-tid-OLD-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-tid-OLD-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0041/CMP0041-tid-OLD.cmake b/Tests/RunCMake/CMP0041/CMP0041-tid-OLD.cmake new file mode 100644 index 0000000..b5c4e7f --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-tid-OLD.cmake @@ -0,0 +1,11 @@ + +cmake_policy(SET CMP0041 OLD) + +add_library(foo empty.cpp) +target_include_directories(foo INTERFACE + include/$<TARGET_PROPERTY:NAME> + ${CMAKE_CURRENT_SOURCE_DIR}/include/$<TARGET_PROPERTY:NAME> + ${CMAKE_CURRENT_BINARY_DIR}/include/$<TARGET_PROPERTY:NAME> +) +install(TARGETS foo EXPORT FooExport DESTINATION lib) +install(EXPORT FooExport DESTINATION lib/cmake) diff --git a/Tests/RunCMake/CMP0041/CMP0041-tid-WARN-result.txt b/Tests/RunCMake/CMP0041/CMP0041-tid-WARN-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-tid-WARN-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0041/CMP0041-tid-WARN-stderr.txt b/Tests/RunCMake/CMP0041/CMP0041-tid-WARN-stderr.txt new file mode 100644 index 0000000..aae2c7a --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-tid-WARN-stderr.txt @@ -0,0 +1,34 @@ +CMake Warning in CMakeLists.txt: + Policy CMP0041 is not set: Error on relative include with generator + expression. Run "cmake --help-policy CMP0041" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + Target "foo" INTERFACE_INCLUDE_DIRECTORIES property contains path: + + ".*/Tests/RunCMake/CMP0041/include/\$<TARGET_PROPERTY:NAME>" + + which is prefixed in the source directory. + + +CMake Warning in CMakeLists.txt: + Policy CMP0041 is not set: Error on relative include with generator + expression. Run "cmake --help-policy CMP0041" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + Target "foo" INTERFACE_INCLUDE_DIRECTORIES property contains path: + + ".*/Tests/RunCMake/CMP0041/include/\$<TARGET_PROPERTY:NAME>" + + which is prefixed in the source directory. + + +CMake Warning in CMakeLists.txt: + Policy CMP0041 is not set: Error on relative include with generator + expression. Run "cmake --help-policy CMP0041" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + Target "foo" INTERFACE_INCLUDE_DIRECTORIES property contains path: + + ".*/Tests/RunCMake/CMP0041/CMP0041-tid-WARN-build/include/\$<TARGET_PROPERTY:NAME>" + + which is prefixed in the build directory. diff --git a/Tests/RunCMake/CMP0041/CMP0041-tid-WARN.cmake b/Tests/RunCMake/CMP0041/CMP0041-tid-WARN.cmake new file mode 100644 index 0000000..ee4c2a6 --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-tid-WARN.cmake @@ -0,0 +1,9 @@ + +add_library(foo empty.cpp) +target_include_directories(foo INTERFACE + include/$<TARGET_PROPERTY:NAME> + ${CMAKE_CURRENT_SOURCE_DIR}/include/$<TARGET_PROPERTY:NAME> + ${CMAKE_CURRENT_BINARY_DIR}/include/$<TARGET_PROPERTY:NAME> +) +install(TARGETS foo EXPORT FooExport DESTINATION lib) +install(EXPORT FooExport DESTINATION lib/cmake) diff --git a/Tests/RunCMake/CMP0041/CMakeLists.txt b/Tests/RunCMake/CMP0041/CMakeLists.txt new file mode 100644 index 0000000..11ea636 --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8) +project(${RunCMake_TEST} CXX) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/CMP0041/RunCMakeTest.cmake b/Tests/RunCMake/CMP0041/RunCMakeTest.cmake new file mode 100644 index 0000000..a5e2114 --- /dev/null +++ b/Tests/RunCMake/CMP0041/RunCMakeTest.cmake @@ -0,0 +1,8 @@ +include(RunCMake) + +run_cmake(CMP0041-OLD) +run_cmake(CMP0041-NEW) +run_cmake(CMP0041-WARN) +run_cmake(CMP0041-tid-OLD) +run_cmake(CMP0041-tid-NEW) +run_cmake(CMP0041-tid-WARN) diff --git a/Tests/RunCMake/CMP0041/empty.cpp b/Tests/RunCMake/CMP0041/empty.cpp new file mode 100644 index 0000000..bfbbdde --- /dev/null +++ b/Tests/RunCMake/CMP0041/empty.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/CMP0042/CMP0042-NEW-result.txt b/Tests/RunCMake/CMP0042/CMP0042-NEW-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0042/CMP0042-NEW-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0042/CMP0042-NEW-stderr.txt b/Tests/RunCMake/CMP0042/CMP0042-NEW-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0042/CMP0042-NEW-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0042/CMP0042-NEW.cmake b/Tests/RunCMake/CMP0042/CMP0042-NEW.cmake new file mode 100644 index 0000000..778a444 --- /dev/null +++ b/Tests/RunCMake/CMP0042/CMP0042-NEW.cmake @@ -0,0 +1,4 @@ + +cmake_policy(SET CMP0042 NEW) + +add_library(foo SHARED empty.cpp) diff --git a/Tests/RunCMake/CMP0042/CMP0042-OLD-result.txt b/Tests/RunCMake/CMP0042/CMP0042-OLD-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0042/CMP0042-OLD-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0042/CMP0042-OLD-stderr.txt b/Tests/RunCMake/CMP0042/CMP0042-OLD-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0042/CMP0042-OLD-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0042/CMP0042-OLD.cmake b/Tests/RunCMake/CMP0042/CMP0042-OLD.cmake new file mode 100644 index 0000000..1aede96 --- /dev/null +++ b/Tests/RunCMake/CMP0042/CMP0042-OLD.cmake @@ -0,0 +1,4 @@ + +cmake_policy(SET CMP0042 OLD) + +add_library(foo SHARED empty.cpp) diff --git a/Tests/RunCMake/CMP0042/CMP0042-WARN-result.txt b/Tests/RunCMake/CMP0042/CMP0042-WARN-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0042/CMP0042-WARN-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0042/CMP0042-WARN-stderr.txt b/Tests/RunCMake/CMP0042/CMP0042-WARN-stderr.txt new file mode 100644 index 0000000..f3574a1 --- /dev/null +++ b/Tests/RunCMake/CMP0042/CMP0042-WARN-stderr.txt @@ -0,0 +1,10 @@ +CMake Warning \(dev\): + Policy CMP0042 is not set: MACOSX_RPATH is enabled by default. Run "cmake + --help-policy CMP0042" for policy details. Use the cmake_policy command to + set the policy and suppress this warning. + + MACOSX_RPATH is not specified for the following targets: + + foo + +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0042/CMP0042-WARN.cmake b/Tests/RunCMake/CMP0042/CMP0042-WARN.cmake new file mode 100644 index 0000000..3fa32b1 --- /dev/null +++ b/Tests/RunCMake/CMP0042/CMP0042-WARN.cmake @@ -0,0 +1,9 @@ + +add_library(foo SHARED empty.cpp) +add_library(foo-static STATIC empty.cpp) +add_library(foo2 SHARED empty.cpp) +set_target_properties(foo2 PROPERTIES MACOSX_RPATH 1) +add_library(foo3 SHARED empty.cpp) +set_target_properties(foo3 PROPERTIES BUILD_WITH_INSTALL_RPATH 1 INSTALL_NAME_DIR "@loader_path") +add_library(foo4 SHARED empty.cpp) +set_target_properties(foo4 PROPERTIES BUILD_WITH_INSTALL_RPATH 1 INSTALL_NAME_DIR "@rpath") diff --git a/Tests/RunCMake/CMP0042/CMakeLists.txt b/Tests/RunCMake/CMP0042/CMakeLists.txt new file mode 100644 index 0000000..11ea636 --- /dev/null +++ b/Tests/RunCMake/CMP0042/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8) +project(${RunCMake_TEST} CXX) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/CMP0042/RunCMakeTest.cmake b/Tests/RunCMake/CMP0042/RunCMakeTest.cmake new file mode 100644 index 0000000..3b226d7 --- /dev/null +++ b/Tests/RunCMake/CMP0042/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(CMP0042-OLD) +run_cmake(CMP0042-NEW) +run_cmake(CMP0042-WARN) diff --git a/Tests/RunCMake/CMP0042/empty.cpp b/Tests/RunCMake/CMP0042/empty.cpp new file mode 100644 index 0000000..bfbbdde --- /dev/null +++ b/Tests/RunCMake/CMP0042/empty.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/CMP0043/CMP0043-NEW-result.txt b/Tests/RunCMake/CMP0043/CMP0043-NEW-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0043/CMP0043-NEW-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0043/CMP0043-NEW-stderr.txt b/Tests/RunCMake/CMP0043/CMP0043-NEW-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0043/CMP0043-NEW-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0043/CMP0043-NEW.cmake b/Tests/RunCMake/CMP0043/CMP0043-NEW.cmake new file mode 100644 index 0000000..857153d --- /dev/null +++ b/Tests/RunCMake/CMP0043/CMP0043-NEW.cmake @@ -0,0 +1,7 @@ + +cmake_policy(SET CMP0043 NEW) + +add_library(foo empty.cpp) +set_property(TARGET foo + PROPERTY COMPILE_DEFINITIONS_DEBUG "DEBUG_MODE" +) diff --git a/Tests/RunCMake/CMP0043/CMP0043-OLD-result.txt b/Tests/RunCMake/CMP0043/CMP0043-OLD-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0043/CMP0043-OLD-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0043/CMP0043-OLD-stderr.txt b/Tests/RunCMake/CMP0043/CMP0043-OLD-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0043/CMP0043-OLD-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0043/CMP0043-OLD.cmake b/Tests/RunCMake/CMP0043/CMP0043-OLD.cmake new file mode 100644 index 0000000..f379430 --- /dev/null +++ b/Tests/RunCMake/CMP0043/CMP0043-OLD.cmake @@ -0,0 +1,7 @@ + +cmake_policy(SET CMP0043 OLD) + +add_library(foo empty.cpp) +set_property(TARGET foo + PROPERTY COMPILE_DEFINITIONS_DEBUG "DEBUG_MODE" +) diff --git a/Tests/RunCMake/CMP0043/CMP0043-WARN-result.txt b/Tests/RunCMake/CMP0043/CMP0043-WARN-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0043/CMP0043-WARN-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0043/CMP0043-WARN-stderr.txt b/Tests/RunCMake/CMP0043/CMP0043-WARN-stderr.txt new file mode 100644 index 0000000..4769a63 --- /dev/null +++ b/Tests/RunCMake/CMP0043/CMP0043-WARN-stderr.txt @@ -0,0 +1,5 @@ +CMake Warning \(dev\) in CMakeLists.txt: + Policy CMP0043 is not set: Ignore COMPILE_DEFINITIONS_<Config> properties. + Run "cmake --help-policy CMP0043" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0043/CMP0043-WARN.cmake b/Tests/RunCMake/CMP0043/CMP0043-WARN.cmake new file mode 100644 index 0000000..161a60d --- /dev/null +++ b/Tests/RunCMake/CMP0043/CMP0043-WARN.cmake @@ -0,0 +1,5 @@ + +add_library(foo empty.cpp) +set_property(TARGET foo + PROPERTY COMPILE_DEFINITIONS_DEBUG "DEBUG_MODE" +) diff --git a/Tests/RunCMake/CMP0043/CMakeLists.txt b/Tests/RunCMake/CMP0043/CMakeLists.txt new file mode 100644 index 0000000..b465c88 --- /dev/null +++ b/Tests/RunCMake/CMP0043/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 2.8) +project(${RunCMake_TEST} CXX) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) + +if(CMAKE_BUILD_TYPE) + # Dummy variable use +endif() diff --git a/Tests/RunCMake/CMP0043/RunCMakeTest.cmake b/Tests/RunCMake/CMP0043/RunCMakeTest.cmake new file mode 100644 index 0000000..7f9572e --- /dev/null +++ b/Tests/RunCMake/CMP0043/RunCMakeTest.cmake @@ -0,0 +1,7 @@ +include(RunCMake) + +list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) + +run_cmake(CMP0043-OLD) +run_cmake(CMP0043-NEW) +run_cmake(CMP0043-WARN) diff --git a/Tests/RunCMake/CMP0043/empty.cpp b/Tests/RunCMake/CMP0043/empty.cpp new file mode 100644 index 0000000..bfbbdde --- /dev/null +++ b/Tests/RunCMake/CMP0043/empty.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/CMP0045/CMP0045-NEW-result.txt b/Tests/RunCMake/CMP0045/CMP0045-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0045/CMP0045-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0045/CMP0045-NEW-stderr.txt b/Tests/RunCMake/CMP0045/CMP0045-NEW-stderr.txt new file mode 100644 index 0000000..805a85e --- /dev/null +++ b/Tests/RunCMake/CMP0045/CMP0045-NEW-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at CMP0045-NEW.cmake:4 \(get_target_property\): + get_target_property\(\) called with non-existent target "tgt". +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CMP0045/CMP0045-NEW.cmake b/Tests/RunCMake/CMP0045/CMP0045-NEW.cmake new file mode 100644 index 0000000..7b2a3cd --- /dev/null +++ b/Tests/RunCMake/CMP0045/CMP0045-NEW.cmake @@ -0,0 +1,4 @@ + +cmake_policy(SET CMP0045 NEW) + +get_target_property(result tgt TYPE) diff --git a/Tests/RunCMake/CMP0045/CMP0045-OLD-result.txt b/Tests/RunCMake/CMP0045/CMP0045-OLD-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0045/CMP0045-OLD-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0045/CMP0045-OLD-stderr.txt b/Tests/RunCMake/CMP0045/CMP0045-OLD-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0045/CMP0045-OLD-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0045/CMP0045-OLD.cmake b/Tests/RunCMake/CMP0045/CMP0045-OLD.cmake new file mode 100644 index 0000000..90201a3 --- /dev/null +++ b/Tests/RunCMake/CMP0045/CMP0045-OLD.cmake @@ -0,0 +1,4 @@ + +cmake_policy(SET CMP0045 OLD) + +get_target_property(result tgt TYPE) diff --git a/Tests/RunCMake/CMP0045/CMP0045-WARN-result.txt b/Tests/RunCMake/CMP0045/CMP0045-WARN-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0045/CMP0045-WARN-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0045/CMP0045-WARN-stderr.txt b/Tests/RunCMake/CMP0045/CMP0045-WARN-stderr.txt new file mode 100644 index 0000000..4c53224 --- /dev/null +++ b/Tests/RunCMake/CMP0045/CMP0045-WARN-stderr.txt @@ -0,0 +1,9 @@ +CMake Warning \(dev\) at CMP0045-WARN.cmake:2 \(get_target_property\): + Policy CMP0045 is not set: Error on non-existent target in + get_target_property. Run "cmake --help-policy CMP0045" for policy details. + Use the cmake_policy command to set the policy and suppress this warning. + + get_target_property\(\) called with non-existent target "tgt". +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0045/CMP0045-WARN.cmake b/Tests/RunCMake/CMP0045/CMP0045-WARN.cmake new file mode 100644 index 0000000..86a99a0 --- /dev/null +++ b/Tests/RunCMake/CMP0045/CMP0045-WARN.cmake @@ -0,0 +1,2 @@ + +get_target_property(result tgt TYPE) diff --git a/Tests/RunCMake/CMP0045/CMakeLists.txt b/Tests/RunCMake/CMP0045/CMakeLists.txt new file mode 100644 index 0000000..11ea636 --- /dev/null +++ b/Tests/RunCMake/CMP0045/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8) +project(${RunCMake_TEST} CXX) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/CMP0045/RunCMakeTest.cmake b/Tests/RunCMake/CMP0045/RunCMakeTest.cmake new file mode 100644 index 0000000..7c0e8a2 --- /dev/null +++ b/Tests/RunCMake/CMP0045/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(CMP0045-OLD) +run_cmake(CMP0045-NEW) +run_cmake(CMP0045-WARN) diff --git a/Tests/RunCMake/CMP0045/empty.cpp b/Tests/RunCMake/CMP0045/empty.cpp new file mode 100644 index 0000000..bfbbdde --- /dev/null +++ b/Tests/RunCMake/CMP0045/empty.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/CMP0046/CMP0046-NEW-existing-dependency-stderr.txt b/Tests/RunCMake/CMP0046/CMP0046-NEW-existing-dependency-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0046/CMP0046-NEW-existing-dependency-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0046/CMP0046-NEW-existing-dependency.cmake b/Tests/RunCMake/CMP0046/CMP0046-NEW-existing-dependency.cmake new file mode 100644 index 0000000..0be290a --- /dev/null +++ b/Tests/RunCMake/CMP0046/CMP0046-NEW-existing-dependency.cmake @@ -0,0 +1,5 @@ +cmake_policy(SET CMP0046 NEW) + +add_custom_target(foo) +add_custom_target(bar) +add_dependencies(foo bar) diff --git a/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency-result.txt b/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency-stderr.txt b/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency-stderr.txt new file mode 100644 index 0000000..0c23c43 --- /dev/null +++ b/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at CMP0046-NEW-missing-dependency.cmake:4 \(add_dependencies\): + Policy CMP0046 is not set: Error on non-existent dependency in + add_dependencies. Run "cmake --help-policy CMP0046" for policy details. + Use the cmake_policy command to set the policy and suppress this warning. ++ + The dependency target "bar" of target "foo" does not exist. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency.cmake b/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency.cmake new file mode 100644 index 0000000..9bb6b90 --- /dev/null +++ b/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency.cmake @@ -0,0 +1,4 @@ +cmake_policy(SET CMP0046 NEW) + +add_custom_target(foo) +add_dependencies(foo bar) diff --git a/Tests/RunCMake/CMP0046/CMP0046-OLD-existing-dependency-stderr.txt b/Tests/RunCMake/CMP0046/CMP0046-OLD-existing-dependency-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0046/CMP0046-OLD-existing-dependency-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0046/CMP0046-OLD-existing-dependency.cmake b/Tests/RunCMake/CMP0046/CMP0046-OLD-existing-dependency.cmake new file mode 100644 index 0000000..b22ab4f --- /dev/null +++ b/Tests/RunCMake/CMP0046/CMP0046-OLD-existing-dependency.cmake @@ -0,0 +1,5 @@ +cmake_policy(SET CMP0046 OLD) + +add_custom_target(foo) +add_custom_target(bar) +add_dependencies(foo bar) diff --git a/Tests/RunCMake/CMP0046/CMP0046-OLD-missing-dependency-stderr.txt b/Tests/RunCMake/CMP0046/CMP0046-OLD-missing-dependency-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0046/CMP0046-OLD-missing-dependency-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0046/CMP0046-OLD-missing-dependency.cmake b/Tests/RunCMake/CMP0046/CMP0046-OLD-missing-dependency.cmake new file mode 100644 index 0000000..5ee3cb7 --- /dev/null +++ b/Tests/RunCMake/CMP0046/CMP0046-OLD-missing-dependency.cmake @@ -0,0 +1,4 @@ +cmake_policy(SET CMP0046 OLD) + +add_custom_target(foo) +add_dependencies(foo bar) diff --git a/Tests/RunCMake/CMP0046/CMP0046-WARN-missing-dependency-stderr.txt b/Tests/RunCMake/CMP0046/CMP0046-WARN-missing-dependency-stderr.txt new file mode 100644 index 0000000..fed36f1 --- /dev/null +++ b/Tests/RunCMake/CMP0046/CMP0046-WARN-missing-dependency-stderr.txt @@ -0,0 +1,9 @@ +CMake Warning \(dev\) at CMP0046-WARN-missing-dependency.cmake:2 \(add_dependencies\): + Policy CMP0046 is not set: Error on non-existent dependency in + add_dependencies. Run "cmake --help-policy CMP0046" for policy details. + Use the cmake_policy command to set the policy and suppress this warning. ++ + The dependency target "bar" of target "foo" does not exist. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0046/CMP0046-WARN-missing-dependency.cmake b/Tests/RunCMake/CMP0046/CMP0046-WARN-missing-dependency.cmake new file mode 100644 index 0000000..896fa40 --- /dev/null +++ b/Tests/RunCMake/CMP0046/CMP0046-WARN-missing-dependency.cmake @@ -0,0 +1,2 @@ +add_custom_target(foo) +add_dependencies(foo bar) diff --git a/Tests/RunCMake/CMP0046/CMakeLists.txt b/Tests/RunCMake/CMP0046/CMakeLists.txt new file mode 100644 index 0000000..2f10cb0 --- /dev/null +++ b/Tests/RunCMake/CMP0046/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.12) +project(${RunCMake_TEST} CXX) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/CMP0046/RunCMakeTest.cmake b/Tests/RunCMake/CMP0046/RunCMakeTest.cmake new file mode 100644 index 0000000..5131e5b --- /dev/null +++ b/Tests/RunCMake/CMP0046/RunCMakeTest.cmake @@ -0,0 +1,8 @@ +include(RunCMake) + +run_cmake(CMP0046-OLD-missing-dependency) +run_cmake(CMP0046-NEW-missing-dependency) +run_cmake(CMP0046-WARN-missing-dependency) + +run_cmake(CMP0046-OLD-existing-dependency) +run_cmake(CMP0046-NEW-existing-dependency) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index e45aba3..1c23bcd 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -53,11 +53,27 @@ endif() add_RunCMake_test(CMP0019) add_RunCMake_test(CMP0022) +add_RunCMake_test(CMP0026) +add_RunCMake_test(CMP0027) +add_RunCMake_test(CMP0028) +add_RunCMake_test(CMP0037) +add_RunCMake_test(CMP0038) +add_RunCMake_test(CMP0039) +add_RunCMake_test(CMP0040) +add_RunCMake_test(CMP0041) +if(CMAKE_SYSTEM_NAME MATCHES Darwin AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG) + add_RunCMake_test(CMP0042) +endif() +add_RunCMake_test(CMP0043) +add_RunCMake_test(CMP0045) +add_RunCMake_test(CMP0046) add_RunCMake_test(CTest) if(UNIX AND "${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles") add_RunCMake_test(CompilerChange) endif() +add_RunCMake_test(CompilerNotFound) add_RunCMake_test(Configure) +add_RunCMake_test(DisallowedCommands) add_RunCMake_test(ExternalData) add_RunCMake_test(FPHSA) add_RunCMake_test(GeneratorExpression) @@ -84,22 +100,32 @@ if(NOT WIN32) add_RunCMake_test(VisibilityPreset) endif() endif() +if (QT4_FOUND) + set(CompatibleInterface_ARGS -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}) +endif() add_RunCMake_test(CompatibleInterface) add_RunCMake_test(Syntax) add_RunCMake_test(add_dependencies) add_RunCMake_test(build_command) +add_RunCMake_test(export) +add_RunCMake_test(cmake_minimum_required) add_RunCMake_test(find_package) add_RunCMake_test(get_filename_component) add_RunCMake_test(if) add_RunCMake_test(include) add_RunCMake_test(include_directories) add_RunCMake_test(list) +add_RunCMake_test(message) +add_RunCMake_test(string) add_RunCMake_test(try_compile) +add_RunCMake_test(set) add_RunCMake_test(variable_watch) add_RunCMake_test(CMP0004) add_RunCMake_test(TargetPolicies) add_RunCMake_test(alias_targets) +add_RunCMake_test(interface_library) +add_RunCMake_test(no_install_prefix) find_package(Qt4 QUIET) find_package(Qt5Core QUIET) @@ -119,3 +145,6 @@ endif() add_RunCMake_test(File_Generate) add_RunCMake_test(ExportWithoutLanguage) add_RunCMake_test(target_link_libraries) +add_RunCMake_test(CheckModules) + +add_RunCMake_test(install) diff --git a/Tests/RunCMake/CTest/BeforeProject-stderr.txt b/Tests/RunCMake/CTest/BeforeProject-stderr.txt index 354896b..2d934a4 100644 --- a/Tests/RunCMake/CTest/BeforeProject-stderr.txt +++ b/Tests/RunCMake/CTest/BeforeProject-stderr.txt @@ -1,6 +1,6 @@ -CMake Error at .*/Modules/CTest.cmake:[0-9]+ \(build_command\): - build_command\(\) requires CMAKE_MAKE_PROGRAM to be defined. Call project\(\) - or enable_language\(\) first. +CMake Error at .*/Modules/CTestTargets.cmake:20 \(message\): + Do not include\(CTest\) before calling project\(\). Call Stack \(most recent call first\): - BeforeProject.cmake:[0-9]+ \(include\) - CMakeLists.txt:[0-9]+ \(include\) + .*/Modules/CTest.cmake:297 \(include\) + BeforeProject.cmake:1 \(include\) + CMakeLists.txt:5 \(include\) diff --git a/Tests/RunCMake/CheckModules/CMakeLists.txt b/Tests/RunCMake/CheckModules/CMakeLists.txt new file mode 100644 index 0000000..65ac8e8 --- /dev/null +++ b/Tests/RunCMake/CheckModules/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.11) +project(${RunCMake_TEST}) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingKey-result.txt b/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingKey-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingKey-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingKey-stderr.txt b/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingKey-stderr.txt new file mode 100644 index 0000000..1b8603a --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingKey-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at .*/Modules/CheckStructHasMember.cmake:[0-9]+. \(message\): + Unknown arguments: + + C + +Call Stack \(most recent call first\): + CheckStructHasMemberMissingKey.cmake:[0-9]+ \(check_struct_has_member\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingKey.cmake b/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingKey.cmake new file mode 100644 index 0000000..49f51ce --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingKey.cmake @@ -0,0 +1,2 @@ +include(CheckStructHasMember) +check_struct_has_member("struct timeval" tv_sec sys/select.h HAVE_TIMEVAL_TV_SEC_K C) diff --git a/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingLanguage-result.txt b/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingLanguage-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingLanguage-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingLanguage-stderr.txt b/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingLanguage-stderr.txt new file mode 100644 index 0000000..8fceab0 --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingLanguage-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at .*/Modules/CheckStructHasMember.cmake:[0-9]+. \(message\): + Unknown arguments: + + LANGUAGE + +Call Stack \(most recent call first\): + CheckStructHasMemberMissingLanguage.cmake:[0-9]+ \(check_struct_has_member\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingLanguage.cmake b/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingLanguage.cmake new file mode 100644 index 0000000..b404d66 --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingLanguage.cmake @@ -0,0 +1,2 @@ +include(CheckStructHasMember) +check_struct_has_member("struct timeval" tv_sec sys/select.h HAVE_TIMEVAL_TV_SEC_K LANGUAGE) diff --git a/Tests/RunCMake/CheckModules/CheckStructHasMemberOk.cmake b/Tests/RunCMake/CheckModules/CheckStructHasMemberOk.cmake new file mode 100644 index 0000000..b319e18 --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckStructHasMemberOk.cmake @@ -0,0 +1,4 @@ +include(CheckStructHasMember) +check_struct_has_member("struct timeval" tv_sec sys/select.h HAVE_TIMEVAL_TV_SEC) +check_struct_has_member("struct timeval" tv_sec sys/select.h HAVE_TIMEVAL_TV_SEC_C LANGUAGE C) +check_struct_has_member("struct timeval" tv_sec sys/select.h HAVE_TIMEVAL_TV_SEC_CXX LANGUAGE CXX) diff --git a/Tests/RunCMake/CheckModules/CheckStructHasMemberTooManyArguments-result.txt b/Tests/RunCMake/CheckModules/CheckStructHasMemberTooManyArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckStructHasMemberTooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CheckModules/CheckStructHasMemberTooManyArguments-stderr.txt b/Tests/RunCMake/CheckModules/CheckStructHasMemberTooManyArguments-stderr.txt new file mode 100644 index 0000000..4598867 --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckStructHasMemberTooManyArguments-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at .*/Modules/CheckStructHasMember.cmake:[0-9]+. \(message\): + Unknown arguments: + + LANGUAGE;C;CXX + +Call Stack \(most recent call first\): + CheckStructHasMemberTooManyArguments.cmake:[0-9]+ \(check_struct_has_member\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CheckModules/CheckStructHasMemberTooManyArguments.cmake b/Tests/RunCMake/CheckModules/CheckStructHasMemberTooManyArguments.cmake new file mode 100644 index 0000000..12f8158 --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckStructHasMemberTooManyArguments.cmake @@ -0,0 +1,2 @@ +include(CheckStructHasMember) +check_struct_has_member("struct timeval" tv_sec sys/select.h HAVE_TIMEVAL_TV_SEC_K LANGUAGE C CXX) diff --git a/Tests/RunCMake/CheckModules/CheckStructHasMemberUnknownLanguage-result.txt b/Tests/RunCMake/CheckModules/CheckStructHasMemberUnknownLanguage-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckStructHasMemberUnknownLanguage-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CheckModules/CheckStructHasMemberUnknownLanguage-stderr.txt b/Tests/RunCMake/CheckModules/CheckStructHasMemberUnknownLanguage-stderr.txt new file mode 100644 index 0000000..ba9e313 --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckStructHasMemberUnknownLanguage-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at .*/Modules/CheckStructHasMember.cmake:[0-9]+. \(message\): + Unknown language: + + FORTRAN + + Supported languages: C, CXX. + +Call Stack \(most recent call first\): + CheckStructHasMemberUnknownLanguage.cmake:[0-9]+ \(check_struct_has_member\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CheckModules/CheckStructHasMemberUnknownLanguage.cmake b/Tests/RunCMake/CheckModules/CheckStructHasMemberUnknownLanguage.cmake new file mode 100644 index 0000000..183058d --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckStructHasMemberUnknownLanguage.cmake @@ -0,0 +1,2 @@ +include(CheckStructHasMember) +check_struct_has_member("struct timeval" tv_sec sys/select.h HAVE_TIMEVAL_TV_SEC_K LANGUAGE FORTRAN) diff --git a/Tests/RunCMake/CheckModules/CheckStructHasMemberWrongKey-result.txt b/Tests/RunCMake/CheckModules/CheckStructHasMemberWrongKey-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckStructHasMemberWrongKey-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CheckModules/CheckStructHasMemberWrongKey-stderr.txt b/Tests/RunCMake/CheckModules/CheckStructHasMemberWrongKey-stderr.txt new file mode 100644 index 0000000..b9fbd38 --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckStructHasMemberWrongKey-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at .*/Modules/CheckStructHasMember.cmake:[0-9]+. \(message\): + Unknown arguments: + + LANGUAG;C + +Call Stack \(most recent call first\): + CheckStructHasMemberWrongKey.cmake:[0-9]+ \(check_struct_has_member\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CheckModules/CheckStructHasMemberWrongKey.cmake b/Tests/RunCMake/CheckModules/CheckStructHasMemberWrongKey.cmake new file mode 100644 index 0000000..900eb0a --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckStructHasMemberWrongKey.cmake @@ -0,0 +1,2 @@ +include(CheckStructHasMember) +check_struct_has_member("struct timeval" tv_sec sys/select.h HAVE_TIMEVAL_TV_SEC_K LANGUAG C) diff --git a/Tests/RunCMake/CheckModules/CheckTypeSizeMissingLanguage-result.txt b/Tests/RunCMake/CheckModules/CheckTypeSizeMissingLanguage-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckTypeSizeMissingLanguage-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CheckModules/CheckTypeSizeMissingLanguage-stderr.txt b/Tests/RunCMake/CheckModules/CheckTypeSizeMissingLanguage-stderr.txt new file mode 100644 index 0000000..07ec8e6 --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckTypeSizeMissingLanguage-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at .*/Modules/CheckTypeSize.cmake:[0-9]+ \(message\): + Missing argument: + + LANGUAGE arguments requires a value + +Call Stack \(most recent call first\): + CheckTypeSizeMissingLanguage.cmake:[0-9]+ \(check_type_size\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CheckModules/CheckTypeSizeMissingLanguage.cmake b/Tests/RunCMake/CheckModules/CheckTypeSizeMissingLanguage.cmake new file mode 100644 index 0000000..3fae6c4 --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckTypeSizeMissingLanguage.cmake @@ -0,0 +1,2 @@ +include(CheckTypeSize) +check_type_size(int SIZEOF_INT LANGUAGE) diff --git a/Tests/RunCMake/CheckModules/CheckTypeSizeMixedArgs-result.txt b/Tests/RunCMake/CheckModules/CheckTypeSizeMixedArgs-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckTypeSizeMixedArgs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CheckModules/CheckTypeSizeMixedArgs-stderr.txt b/Tests/RunCMake/CheckModules/CheckTypeSizeMixedArgs-stderr.txt new file mode 100644 index 0000000..a2d2fc0 --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckTypeSizeMixedArgs-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at .*/Modules/CheckTypeSize.cmake:[0-9]+. \(message\): + Unknown language: + + . + + Supported languages: C, CXX. + +Call Stack \(most recent call first\): + CheckTypeSizeMixedArgs.cmake:[0-9]+ \(check_type_size\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CheckModules/CheckTypeSizeMixedArgs.cmake b/Tests/RunCMake/CheckModules/CheckTypeSizeMixedArgs.cmake new file mode 100644 index 0000000..d2ccc0f --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckTypeSizeMixedArgs.cmake @@ -0,0 +1,2 @@ +include(CheckTypeSize) +check_type_size(int SIZEOF_INT LANGUAGE BUILTIN_TYPES_ONLY) diff --git a/Tests/RunCMake/CheckModules/CheckTypeSizeOk.cmake b/Tests/RunCMake/CheckModules/CheckTypeSizeOk.cmake new file mode 100644 index 0000000..558f07e --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckTypeSizeOk.cmake @@ -0,0 +1,10 @@ +include(CheckTypeSize) +check_type_size(int SIZEOF_INT) +check_type_size(int SIZEOF_INT BUILTIN_TYPES_ONLY) +check_type_size(int SIZEOF_INT LANGUAGE C) +check_type_size(int SIZEOF_INT LANGUAGE CXX) +check_type_size(int SIZEOF_INT BUILTIN_TYPES_ONLY LANGUAGE C) + +# Weird but ok... only last value is considered +check_type_size(int SIZEOF_INT BUILTIN_TYPES_ONLY BUILTIN_TYPES_ONLY) +check_type_size(int SIZEOF_INT LANGUAGE C LANGUAGE CXX) diff --git a/Tests/RunCMake/CheckModules/CheckTypeSizeUnknownArgument-result.txt b/Tests/RunCMake/CheckModules/CheckTypeSizeUnknownArgument-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckTypeSizeUnknownArgument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CheckModules/CheckTypeSizeUnknownArgument-stderr.txt b/Tests/RunCMake/CheckModules/CheckTypeSizeUnknownArgument-stderr.txt new file mode 100644 index 0000000..085488e --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckTypeSizeUnknownArgument-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at .*/Modules/CheckTypeSize.cmake:[0-9]+. \(message\): + Unknown argument: + + LANGUAG + +Call Stack \(most recent call first\): + CheckTypeSizeUnknownArgument.cmake:[0-9]+ \(check_type_size\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CheckModules/CheckTypeSizeUnknownArgument.cmake b/Tests/RunCMake/CheckModules/CheckTypeSizeUnknownArgument.cmake new file mode 100644 index 0000000..6f24ee1 --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckTypeSizeUnknownArgument.cmake @@ -0,0 +1,2 @@ +include(CheckTypeSize) +check_type_size(int SIZEOF_INT BUILTIN_TYPES_ONLY LANGUAG CXX) diff --git a/Tests/RunCMake/CheckModules/CheckTypeSizeUnknownLanguage-result.txt b/Tests/RunCMake/CheckModules/CheckTypeSizeUnknownLanguage-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckTypeSizeUnknownLanguage-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CheckModules/CheckTypeSizeUnknownLanguage-stderr.txt b/Tests/RunCMake/CheckModules/CheckTypeSizeUnknownLanguage-stderr.txt new file mode 100644 index 0000000..502a717 --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckTypeSizeUnknownLanguage-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at .*/Modules/CheckTypeSize.cmake:[0-9]+. \(message\): + Unknown language: + + FORTRAN. + + Supported languages: C, CXX. + +Call Stack \(most recent call first\): + CheckTypeSizeUnknownLanguage.cmake:[0-9]+ \(check_type_size\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CheckModules/CheckTypeSizeUnknownLanguage.cmake b/Tests/RunCMake/CheckModules/CheckTypeSizeUnknownLanguage.cmake new file mode 100644 index 0000000..2d5184c --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckTypeSizeUnknownLanguage.cmake @@ -0,0 +1,2 @@ +include(CheckTypeSize) +check_type_size(int SIZEOF_INT LANGUAGE FORTRAN) diff --git a/Tests/RunCMake/CheckModules/RunCMakeTest.cmake b/Tests/RunCMake/CheckModules/RunCMakeTest.cmake new file mode 100644 index 0000000..fda7ebf --- /dev/null +++ b/Tests/RunCMake/CheckModules/RunCMakeTest.cmake @@ -0,0 +1,14 @@ +include(RunCMake) + +run_cmake(CheckStructHasMemberOk) +run_cmake(CheckStructHasMemberUnknownLanguage) +run_cmake(CheckStructHasMemberMissingLanguage) +run_cmake(CheckStructHasMemberMissingKey) +run_cmake(CheckStructHasMemberTooManyArguments) +run_cmake(CheckStructHasMemberWrongKey) + +run_cmake(CheckTypeSizeOk) +run_cmake(CheckTypeSizeUnknownLanguage) +run_cmake(CheckTypeSizeMissingLanguage) +run_cmake(CheckTypeSizeUnknownArgument) +run_cmake(CheckTypeSizeMixedArgs) diff --git a/Tests/RunCMake/CompatibleInterface/AutoUic-result.txt b/Tests/RunCMake/CompatibleInterface/AutoUic-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/AutoUic-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompatibleInterface/AutoUic-stderr.txt b/Tests/RunCMake/CompatibleInterface/AutoUic-stderr.txt new file mode 100644 index 0000000..09f9461 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/AutoUic-stderr.txt @@ -0,0 +1,11 @@ +CMake Error: The INTERFACE_AUTOUIC_OPTIONS property of "OtherI18n" does +not agree with the value of AUTOUIC_OPTIONS already determined +for "LibWidget". + +CMake Debug Log: + String compatibility of property "AUTOUIC_OPTIONS" for target "LibWidget" + \(result: "-tr;ki18n"\): + + \* Target "LibWidget" property not set. + \* Target "KI18n" property value "-tr;ki18n" \(Interface set\) + \* Target "OtherI18n" property value "-tr;otheri18n" \(Disagree\) diff --git a/Tests/RunCMake/CompatibleInterface/AutoUic.cmake b/Tests/RunCMake/CompatibleInterface/AutoUic.cmake new file mode 100644 index 0000000..03635e2 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/AutoUic.cmake @@ -0,0 +1,19 @@ + +find_package(Qt4 REQUIRED) + +set(CMAKE_AUTOUIC ON) + +set(CMAKE_DEBUG_TARGET_PROPERTIES AUTOUIC_OPTIONS) + +add_library(KI18n INTERFACE) +set_property(TARGET KI18n APPEND PROPERTY + INTERFACE_AUTOUIC_OPTIONS -tr ki18n +) + +add_library(OtherI18n INTERFACE) +set_property(TARGET OtherI18n APPEND PROPERTY + INTERFACE_AUTOUIC_OPTIONS -tr otheri18n +) + +add_library(LibWidget empty.cpp) +target_link_libraries(LibWidget KI18n OtherI18n Qt4::QtGui) diff --git a/Tests/RunCMake/CompatibleInterface/DebugProperties-result.txt b/Tests/RunCMake/CompatibleInterface/DebugProperties-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/DebugProperties-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt b/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt new file mode 100644 index 0000000..17b8a5c --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt @@ -0,0 +1,101 @@ +CMake Debug Log: + Boolean compatibility of property "BOOL_PROP1" for target + "CompatibleInterface" \(result: "TRUE"\): + + \* Target "CompatibleInterface" property not set. + \* Target "iface1" property value "TRUE" \(Interface set\) ++ +CMake Debug Log: + Boolean compatibility of property "BOOL_PROP2" for target + "CompatibleInterface" \(result: "TRUE"\): + + \* Target "CompatibleInterface" has property content "TRUE" + \* Target "iface1" property value "TRUE" \(Agree\) ++ +CMake Debug Log: + Boolean compatibility of property "BOOL_PROP3" for target + "CompatibleInterface" \(result: "TRUE"\): + + \* Target "CompatibleInterface" has property content "TRUE" ++ +CMake Debug Log: + Boolean compatibility of property "BOOL_PROP4" for target + "CompatibleInterface" \(result: "FALSE"\): + + \* Target "CompatibleInterface" property not set. ++ +CMake Debug Log: + Boolean compatibility of property "BOOL_PROP5" for target + "CompatibleInterface" \(result: "FALSE"\): + + \* Target "CompatibleInterface" property not set. + \* Target "iface1" property value "FALSE" \(Interface set\) ++ +CMake Debug Log: + Boolean compatibility of property "BOOL_PROP6" for target + "CompatibleInterface" \(result: "FALSE"\): + + \* Target "CompatibleInterface" property not set. + \* Target "iface1" property value "FALSE" \(Interface set\) + \* Target "iface2" property value "FALSE" \(Agree\) ++ +CMake Debug Log: + Boolean compatibility of property "BOOL_PROP7" for target + "CompatibleInterface" \(result: "FALSE"\): + + \* Target "CompatibleInterface" property is implied by use. + \* Target "iface1" property value "FALSE" \(Agree\) ++ +CMake Debug Log: + String compatibility of property "STRING_PROP1" for target + "CompatibleInterface" \(result: "prop1"\): + + \* Target "CompatibleInterface" property not set. + \* Target "iface1" property value "prop1" \(Interface set\) ++ +CMake Debug Log: + String compatibility of property "STRING_PROP2" for target + "CompatibleInterface" \(result: "prop2"\): + + \* Target "CompatibleInterface" has property content "prop2" + \* Target "iface1" property value "prop2" \(Agree\) ++ +CMake Debug Log: + String compatibility of property "STRING_PROP3" for target + "CompatibleInterface" \(result: "prop3"\): + + \* Target "CompatibleInterface" has property content "prop3" ++ +CMake Debug Log: + String compatibility of property "STRING_PROP4" for target + "CompatibleInterface" \(result: "\(unset\)"\): + + \* Target "CompatibleInterface" property not set. ++ +CMake Debug Log: + Numeric minimum compatibility of property "NUMBER_MIN_PROP1" for target + "CompatibleInterface" \(result: "50"\): + + \* Target "CompatibleInterface" has property content "50" + \* Target "iface1" property value "100" \(Ignored\) ++ +CMake Debug Log: + Numeric minimum compatibility of property "NUMBER_MIN_PROP2" for target + "CompatibleInterface" \(result: "200"\): + + \* Target "CompatibleInterface" has property content "250" + \* Target "iface1" property value "200" \(Dominant\) ++ +CMake Debug Log: + Numeric maximum compatibility of property "NUMBER_MAX_PROP1" for target + "CompatibleInterface" \(result: "100"\): + + \* Target "CompatibleInterface" has property content "50" + \* Target "iface1" property value "100" \(Dominant\) ++ +CMake Debug Log: + Numeric maximum compatibility of property "NUMBER_MAX_PROP2" for target + "CompatibleInterface" \(result: "250"\): + + \* Target "CompatibleInterface" has property content "250" + \* Target "iface1" property value "200" \(Ignored\) diff --git a/Tests/RunCMake/CompatibleInterface/DebugProperties.cmake b/Tests/RunCMake/CompatibleInterface/DebugProperties.cmake new file mode 100644 index 0000000..0196611 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/DebugProperties.cmake @@ -0,0 +1,74 @@ + +cmake_minimum_required(VERSION 2.8) + +project(CompatibleInterface) + +include(GenerateExportHeader) +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_library(iface1 INTERFACE) +set_property(TARGET iface1 APPEND PROPERTY + COMPATIBLE_INTERFACE_BOOL + BOOL_PROP1 + BOOL_PROP2 + BOOL_PROP3 + BOOL_PROP4 + BOOL_PROP5 + BOOL_PROP6 + BOOL_PROP7 +) +set_property(TARGET iface1 APPEND PROPERTY + COMPATIBLE_INTERFACE_STRING + STRING_PROP1 + STRING_PROP2 + STRING_PROP3 + STRING_PROP4 # Not set. +) +set_property(TARGET iface1 APPEND PROPERTY + COMPATIBLE_INTERFACE_NUMBER_MIN + NUMBER_MIN_PROP1 + NUMBER_MIN_PROP2 +) +set_property(TARGET iface1 APPEND PROPERTY + COMPATIBLE_INTERFACE_NUMBER_MAX + NUMBER_MAX_PROP1 + NUMBER_MAX_PROP2 +) + +set(CMAKE_DEBUG_TARGET_PROPERTIES + BOOL_PROP1 BOOL_PROP2 BOOL_PROP3 BOOL_PROP4 BOOL_PROP5 BOOL_PROP6 BOOL_PROP7 + STRING_PROP1 STRING_PROP2 STRING_PROP3 STRING_PROP4 + NUMBER_MIN_PROP1 NUMBER_MIN_PROP2 + NUMBER_MAX_PROP1 NUMBER_MAX_PROP2 +) + +set_property(TARGET iface1 PROPERTY INTERFACE_BOOL_PROP1 ON) +set_property(TARGET iface1 PROPERTY INTERFACE_BOOL_PROP2 ON) +set_property(TARGET iface1 PROPERTY INTERFACE_BOOL_PROP5 OFF) +set_property(TARGET iface1 PROPERTY INTERFACE_BOOL_PROP6 OFF) +set_property(TARGET iface1 PROPERTY INTERFACE_BOOL_PROP7 OFF) +set_property(TARGET iface1 PROPERTY INTERFACE_STRING_PROP1 prop1) +set_property(TARGET iface1 PROPERTY INTERFACE_STRING_PROP2 prop2) +set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MIN_PROP1 100) +set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MIN_PROP2 200) +set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MAX_PROP1 100) +set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MAX_PROP2 200) + +add_library(iface2 INTERFACE) +set_property(TARGET iface2 PROPERTY INTERFACE_BOOL_PROP6 OFF) + +add_library(iface3 INTERFACE) + +add_executable(CompatibleInterface empty.cpp) +target_link_libraries(CompatibleInterface iface1 iface2 + $<$<BOOL:$<TARGET_PROPERTY:BOOL_PROP7>>:iface3> +) + +set_property(TARGET CompatibleInterface PROPERTY BOOL_PROP2 ON) +set_property(TARGET CompatibleInterface PROPERTY BOOL_PROP3 ON) +set_property(TARGET CompatibleInterface PROPERTY STRING_PROP2 prop2) +set_property(TARGET CompatibleInterface PROPERTY STRING_PROP3 prop3) +set_property(TARGET CompatibleInterface PROPERTY NUMBER_MIN_PROP1 50) +set_property(TARGET CompatibleInterface PROPERTY NUMBER_MIN_PROP2 250) +set_property(TARGET CompatibleInterface PROPERTY NUMBER_MAX_PROP1 50) +set_property(TARGET CompatibleInterface PROPERTY NUMBER_MAX_PROP2 250) diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceNumber-mismatched-use-result.txt b/Tests/RunCMake/CompatibleInterface/InterfaceNumber-mismatched-use-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceNumber-mismatched-use-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceNumber-mismatched-use-stderr.txt b/Tests/RunCMake/CompatibleInterface/InterfaceNumber-mismatched-use-stderr.txt new file mode 100644 index 0000000..723daec --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceNumber-mismatched-use-stderr.txt @@ -0,0 +1,4 @@ +CMake Error: Property SOMEPROP on target "user" is +implied to be empty because it was used to determine the link libraries +already. The INTERFACE_SOMEPROP property on +dependency "foo" is in conflict. diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceNumber-mismatched-use.cmake b/Tests/RunCMake/CompatibleInterface/InterfaceNumber-mismatched-use.cmake new file mode 100644 index 0000000..a064d76 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceNumber-mismatched-use.cmake @@ -0,0 +1,9 @@ + +add_library(foo UNKNOWN IMPORTED) +add_library(bar UNKNOWN IMPORTED) + +set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_NUMBER_MIN SOMEPROP) +set_property(TARGET foo PROPERTY INTERFACE_SOMEPROP 42) + +add_executable(user main.cpp) +target_link_libraries(user foo $<$<STREQUAL:$<TARGET_PROPERTY:SOMEPROP>,42>:bar>) diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict-stderr.txt b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict-stderr.txt index 5a8f99d..900e3f8 100644 --- a/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict-stderr.txt +++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict-stderr.txt @@ -2,4 +2,5 @@ CMake Error in CMakeLists.txt: Property "SOMETHING" appears in both the COMPATIBLE_INTERFACE_BOOL and the COMPATIBLE_INTERFACE_STRING property in the dependencies of target "user". This is not allowed. A property may only require compatibility in a - boolean interpretation or a string interpretation, but not both. + boolean interpretation, a numeric minimum, a numeric maximum or a string + interpretation, but not a mixture. diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict.cmake b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict.cmake index 711368a..4bae804 100644 --- a/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict.cmake +++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict.cmake @@ -1,9 +1,8 @@ add_library(foo UNKNOWN IMPORTED) -add_library(bar UNKNOWN IMPORTED) set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SOMETHING) set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_STRING SOMETHING) add_executable(user main.cpp) -target_link_libraries(user foo bar) +target_link_libraries(user foo) diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Min-Conflict-result.txt b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Min-Conflict-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Min-Conflict-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Min-Conflict-stderr.txt b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Min-Conflict-stderr.txt new file mode 100644 index 0000000..2cfbae4 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Min-Conflict-stderr.txt @@ -0,0 +1,7 @@ +CMake Error in CMakeLists.txt: + Property "OTHER" appears in both the COMPATIBLE_INTERFACE_BOOL, + COMPATIBLE_INTERFACE_NUMBER_MIN and the COMPATIBLE_INTERFACE_STRING + property in the dependencies of target "user". This is not allowed. A + property may only require compatibility in a boolean interpretation, a + numeric minimum, a numeric maximum or a string interpretation, but not a + mixture. diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Min-Conflict.cmake b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Min-Conflict.cmake new file mode 100644 index 0000000..164ffd9 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Min-Conflict.cmake @@ -0,0 +1,9 @@ + +add_library(foo UNKNOWN IMPORTED) + +set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL OTHER) +set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_STRING OTHER) +set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_NUMBER_MIN OTHER) + +add_executable(user main.cpp) +target_link_libraries(user foo) diff --git a/Tests/RunCMake/CompatibleInterface/RunCMakeTest.cmake b/Tests/RunCMake/CompatibleInterface/RunCMakeTest.cmake index 9768151..0b9729b 100644 --- a/Tests/RunCMake/CompatibleInterface/RunCMakeTest.cmake +++ b/Tests/RunCMake/CompatibleInterface/RunCMakeTest.cmake @@ -7,5 +7,13 @@ run_cmake(InterfaceBool-builtin-prop) run_cmake(InterfaceString-mismatch-depends) run_cmake(InterfaceString-mismatch-depend-self) run_cmake(InterfaceString-mismatched-use) +run_cmake(InterfaceNumber-mismatched-use) run_cmake(InterfaceString-builtin-prop) run_cmake(InterfaceString-Bool-Conflict) +run_cmake(InterfaceString-Bool-Min-Conflict) +run_cmake(DebugProperties) + +if (QT_QMAKE_EXECUTABLE}) + set(RunCMake_TEST_OPTIONS -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}) + run_cmake(AutoUic) +endif() diff --git a/Tests/RunCMake/CompatibleInterface/empty.cpp b/Tests/RunCMake/CompatibleInterface/empty.cpp new file mode 100644 index 0000000..0032329 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/empty.cpp @@ -0,0 +1 @@ +// no content diff --git a/Tests/RunCMake/CompilerChange/EmptyCompiler-override.cmake b/Tests/RunCMake/CompilerChange/EmptyCompiler-override.cmake new file mode 100644 index 0000000..28d29e0 --- /dev/null +++ b/Tests/RunCMake/CompilerChange/EmptyCompiler-override.cmake @@ -0,0 +1,2 @@ +message(STATUS "CMAKE_C_COMPILER is \"${CMAKE_C_COMPILER}\"") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cc.cmake" "set(CMAKE_C_COMPILER \"${CMAKE_C_COMPILER}\")\n") diff --git a/Tests/RunCMake/CompilerChange/EmptyCompiler-stderr.txt b/Tests/RunCMake/CompilerChange/EmptyCompiler-stderr.txt index 4745b25..cf3b1b3 100644 --- a/Tests/RunCMake/CompilerChange/EmptyCompiler-stderr.txt +++ b/Tests/RunCMake/CompilerChange/EmptyCompiler-stderr.txt @@ -1,5 +1,13 @@ You have changed variables that require your cache to be deleted. Configure will be re-run and you may have to reset some variables. The following variables have changed: -CMAKE_C_COMPILER= *( -|$) +CMAKE_C_COMPILER= * ++ +CMake Error at EmptyCompiler.cmake:2 \(enable_language\): + No CMAKE_C_COMPILER could be found. + + Tell CMake where to find the compiler by setting either the environment + variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to + the compiler, or to the compiler name if it is in the PATH. +Call Stack \(most recent call first\): + CMakeLists.txt:6 \(include\)$ diff --git a/Tests/RunCMake/CompilerChange/EmptyCompiler.cmake b/Tests/RunCMake/CompilerChange/EmptyCompiler.cmake index c87ec49..06e9e03 100644 --- a/Tests/RunCMake/CompilerChange/EmptyCompiler.cmake +++ b/Tests/RunCMake/CompilerChange/EmptyCompiler.cmake @@ -1,3 +1,2 @@ +set(CMAKE_USER_MAKE_RULES_OVERRIDE_C ${CMAKE_CURRENT_LIST_DIR}/EmptyCompiler-override.cmake) enable_language(C) -message(STATUS "CMAKE_C_COMPILER is \"${CMAKE_C_COMPILER}\"") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cc.cmake" "set(CMAKE_C_COMPILER \"${CMAKE_C_COMPILER}\")\n") diff --git a/Tests/RunCMake/CompilerChange/RunCMakeTest.cmake b/Tests/RunCMake/CompilerChange/RunCMakeTest.cmake index d383716..5bb2821 100644 --- a/Tests/RunCMake/CompilerChange/RunCMakeTest.cmake +++ b/Tests/RunCMake/CompilerChange/RunCMakeTest.cmake @@ -22,8 +22,8 @@ set(ccIn ${RunCMake_SOURCE_DIR}/cc.sh.in) set(cc1 ${RunCMake_BINARY_DIR}/cc1.sh) set(cc2 ${RunCMake_BINARY_DIR}/cc2.sh) set(cc3 CMAKE_C_COMPILER-NOTFOUND) -configure_file(${ccIn} ${cc1} @ONLY IMMEDIATE) -configure_file(${ccIn} ${cc2} @ONLY IMMEDIATE) +configure_file(${ccIn} ${cc1} @ONLY) +configure_file(${ccIn} ${cc2} @ONLY) # Use a single build tree for remaining tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ChangeCompiler-build) diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerC-result.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerC-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompilerNotFound/BadCompilerC-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr.txt new file mode 100644 index 0000000..c98842d --- /dev/null +++ b/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr.txt @@ -0,0 +1,12 @@ +CMake Error at BadCompilerC.cmake:2 \(enable_language\): + The CMAKE_C_COMPILER: + + no-C-compiler + + is not a full path and was not found in the PATH. + + Tell CMake where to find the compiler by setting either the environment + variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to + the compiler, or to the compiler name if it is in the PATH. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerC.cmake b/Tests/RunCMake/CompilerNotFound/BadCompilerC.cmake new file mode 100644 index 0000000..10fe59a --- /dev/null +++ b/Tests/RunCMake/CompilerNotFound/BadCompilerC.cmake @@ -0,0 +1,3 @@ +set(CMAKE_C_COMPILER "no-C-compiler") +enable_language(C) +message(FATAL_ERROR "This error should not be reached.") diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-result.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr.txt new file mode 100644 index 0000000..7ef4f5e --- /dev/null +++ b/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr.txt @@ -0,0 +1,12 @@ +CMake Error at BadCompilerCXX.cmake:2 \(enable_language\): + The CMAKE_CXX_COMPILER: + + no-CXX-compiler + + is not a full path and was not found in the PATH. + + Tell CMake where to find the compiler by setting either the environment + variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path + to the compiler, or to the compiler name if it is in the PATH. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerCXX.cmake b/Tests/RunCMake/CompilerNotFound/BadCompilerCXX.cmake new file mode 100644 index 0000000..3b1e890 --- /dev/null +++ b/Tests/RunCMake/CompilerNotFound/BadCompilerCXX.cmake @@ -0,0 +1,3 @@ +set(CMAKE_CXX_COMPILER "no-CXX-compiler") +enable_language(CXX) +message(FATAL_ERROR "This error should not be reached.") diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-result.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr.txt new file mode 100644 index 0000000..eecff54 --- /dev/null +++ b/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr.txt @@ -0,0 +1,25 @@ +CMake Error at BadCompilerCandCXX.cmake:3 \(project\): + The CMAKE_C_COMPILER: + + no-C-compiler + + is not a full path and was not found in the PATH. + + Tell CMake where to find the compiler by setting either the environment + variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to + the compiler, or to the compiler name if it is in the PATH. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadCompilerCandCXX.cmake:3 \(project\): + The CMAKE_CXX_COMPILER: + + no-CXX-compiler + + is not a full path and was not found in the PATH. + + Tell CMake where to find the compiler by setting either the environment + variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path + to the compiler, or to the compiler name if it is in the PATH. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX.cmake b/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX.cmake new file mode 100644 index 0000000..2b6fa61 --- /dev/null +++ b/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX.cmake @@ -0,0 +1,4 @@ +set(CMAKE_C_COMPILER "no-C-compiler") +set(CMAKE_CXX_COMPILER "no-CXX-compiler") +project(BadCompilerCandCXXInner C CXX) +message(FATAL_ERROR "This error should not be reached.") diff --git a/Tests/RunCMake/CompilerNotFound/CMakeLists.txt b/Tests/RunCMake/CompilerNotFound/CMakeLists.txt new file mode 100644 index 0000000..12cd3c7 --- /dev/null +++ b/Tests/RunCMake/CompilerNotFound/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.4) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CompilerNotFound/NoCompilerC-IDE-result.txt b/Tests/RunCMake/CompilerNotFound/NoCompilerC-IDE-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompilerNotFound/NoCompilerC-IDE-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompilerNotFound/NoCompilerC-IDE-stderr.txt b/Tests/RunCMake/CompilerNotFound/NoCompilerC-IDE-stderr.txt new file mode 100644 index 0000000..88bb95e --- /dev/null +++ b/Tests/RunCMake/CompilerNotFound/NoCompilerC-IDE-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at NoCompilerC-IDE.cmake:2 \(enable_language\): + No CMAKE_C_COMPILER could be found. + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/CompilerNotFound/NoCompilerC-IDE.cmake b/Tests/RunCMake/CompilerNotFound/NoCompilerC-IDE.cmake new file mode 100644 index 0000000..45e1a68 --- /dev/null +++ b/Tests/RunCMake/CompilerNotFound/NoCompilerC-IDE.cmake @@ -0,0 +1,3 @@ +set(CMAKE_C_COMPILER_ID_ERROR_FOR_TEST "#error NoCompilerC-IDE") +enable_language(C) +message(FATAL_ERROR "This error should not be reached.") diff --git a/Tests/RunCMake/CompilerNotFound/NoCompilerCXX-IDE-result.txt b/Tests/RunCMake/CompilerNotFound/NoCompilerCXX-IDE-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompilerNotFound/NoCompilerCXX-IDE-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompilerNotFound/NoCompilerCXX-IDE-stderr.txt b/Tests/RunCMake/CompilerNotFound/NoCompilerCXX-IDE-stderr.txt new file mode 100644 index 0000000..4c92323 --- /dev/null +++ b/Tests/RunCMake/CompilerNotFound/NoCompilerCXX-IDE-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at NoCompilerCXX-IDE.cmake:2 \(enable_language\): + No CMAKE_CXX_COMPILER could be found. + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/CompilerNotFound/NoCompilerCXX-IDE.cmake b/Tests/RunCMake/CompilerNotFound/NoCompilerCXX-IDE.cmake new file mode 100644 index 0000000..85025a0 --- /dev/null +++ b/Tests/RunCMake/CompilerNotFound/NoCompilerCXX-IDE.cmake @@ -0,0 +1,3 @@ +set(CMAKE_CXX_COMPILER_ID_ERROR_FOR_TEST "#error NoCompilerCXX-IDE") +enable_language(CXX) +message(FATAL_ERROR "This error should not be reached.") diff --git a/Tests/RunCMake/CompilerNotFound/NoCompilerCandCXX-IDE-result.txt b/Tests/RunCMake/CompilerNotFound/NoCompilerCandCXX-IDE-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompilerNotFound/NoCompilerCandCXX-IDE-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompilerNotFound/NoCompilerCandCXX-IDE-stderr.txt b/Tests/RunCMake/CompilerNotFound/NoCompilerCandCXX-IDE-stderr.txt new file mode 100644 index 0000000..21c69f5 --- /dev/null +++ b/Tests/RunCMake/CompilerNotFound/NoCompilerCandCXX-IDE-stderr.txt @@ -0,0 +1,11 @@ +CMake Error at NoCompilerCandCXX-IDE.cmake:3 \(project\): + No CMAKE_C_COMPILER could be found. + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at NoCompilerCandCXX-IDE.cmake:3 \(project\): + No CMAKE_CXX_COMPILER could be found. + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/CompilerNotFound/NoCompilerCandCXX-IDE.cmake b/Tests/RunCMake/CompilerNotFound/NoCompilerCandCXX-IDE.cmake new file mode 100644 index 0000000..78256a9 --- /dev/null +++ b/Tests/RunCMake/CompilerNotFound/NoCompilerCandCXX-IDE.cmake @@ -0,0 +1,4 @@ +set(CMAKE_C_COMPILER_ID_ERROR_FOR_TEST "#error NoCompilerCandCXX-IDE") +set(CMAKE_CXX_COMPILER_ID_ERROR_FOR_TEST "#error NoCompilerCandCXX-IDE") +project(NoCompilerCandCXXInner C CXX) +message(FATAL_ERROR "This error should not be reached.") diff --git a/Tests/RunCMake/CompilerNotFound/RunCMakeTest.cmake b/Tests/RunCMake/CompilerNotFound/RunCMakeTest.cmake new file mode 100644 index 0000000..8b84f39 --- /dev/null +++ b/Tests/RunCMake/CompilerNotFound/RunCMakeTest.cmake @@ -0,0 +1,11 @@ +include(RunCMake) + +if("${RunCMake_GENERATOR}" MATCHES "Visual Studio|Xcode") + run_cmake(NoCompilerC-IDE) + run_cmake(NoCompilerCXX-IDE) + run_cmake(NoCompilerCandCXX-IDE) +else() + run_cmake(BadCompilerC) + run_cmake(BadCompilerCXX) + run_cmake(BadCompilerCandCXX) +endif() diff --git a/Tests/RunCMake/DisallowedCommands/CMP0029-NEW-result.txt b/Tests/RunCMake/DisallowedCommands/CMP0029-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0029-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/DisallowedCommands/CMP0029-NEW-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0029-NEW-stderr.txt new file mode 100644 index 0000000..e147081 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0029-NEW-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at CMP0029-NEW.cmake:2 \(subdir_depends\): + The subdir_depends command should not be called; see CMP0029. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/DisallowedCommands/CMP0029-NEW.cmake b/Tests/RunCMake/DisallowedCommands/CMP0029-NEW.cmake new file mode 100644 index 0000000..392b9d4 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0029-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0029 NEW) +subdir_depends() diff --git a/Tests/RunCMake/DisallowedCommands/CMP0029-OLD-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0029-OLD-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0029-OLD-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/DisallowedCommands/CMP0029-OLD.cmake b/Tests/RunCMake/DisallowedCommands/CMP0029-OLD.cmake new file mode 100644 index 0000000..099fd90 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0029-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0029 OLD) +subdir_depends() diff --git a/Tests/RunCMake/DisallowedCommands/CMP0029-WARN-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0029-WARN-stderr.txt new file mode 100644 index 0000000..32a452a --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0029-WARN-stderr.txt @@ -0,0 +1,7 @@ +CMake Warning \(dev\) at CMP0029-WARN.cmake:1 \(subdir_depends\): + Policy CMP0029 is not set: The subdir_depends command should not be called. + Run "cmake --help-policy CMP0029" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/DisallowedCommands/CMP0029-WARN.cmake b/Tests/RunCMake/DisallowedCommands/CMP0029-WARN.cmake new file mode 100644 index 0000000..1ceb1f8 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0029-WARN.cmake @@ -0,0 +1 @@ +subdir_depends() diff --git a/Tests/RunCMake/DisallowedCommands/CMP0030-NEW-result.txt b/Tests/RunCMake/DisallowedCommands/CMP0030-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0030-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/DisallowedCommands/CMP0030-NEW-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0030-NEW-stderr.txt new file mode 100644 index 0000000..cb380db --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0030-NEW-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at CMP0030-NEW.cmake:2 \(use_mangled_mesa\): + The use_mangled_mesa command should not be called; see CMP0030. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/DisallowedCommands/CMP0030-NEW.cmake b/Tests/RunCMake/DisallowedCommands/CMP0030-NEW.cmake new file mode 100644 index 0000000..73365a7 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0030-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0030 NEW) +use_mangled_mesa() diff --git a/Tests/RunCMake/DisallowedCommands/CMP0030-OLD-result.txt b/Tests/RunCMake/DisallowedCommands/CMP0030-OLD-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0030-OLD-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/DisallowedCommands/CMP0030-OLD-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0030-OLD-stderr.txt new file mode 100644 index 0000000..e95e16f --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0030-OLD-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at CMP0030-OLD.cmake:2 \(use_mangled_mesa\): + use_mangled_mesa called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/DisallowedCommands/CMP0030-OLD.cmake b/Tests/RunCMake/DisallowedCommands/CMP0030-OLD.cmake new file mode 100644 index 0000000..efbb852 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0030-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0030 OLD) +use_mangled_mesa() diff --git a/Tests/RunCMake/DisallowedCommands/CMP0030-WARN-result.txt b/Tests/RunCMake/DisallowedCommands/CMP0030-WARN-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0030-WARN-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/DisallowedCommands/CMP0030-WARN-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0030-WARN-stderr.txt new file mode 100644 index 0000000..db3c23f13 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0030-WARN-stderr.txt @@ -0,0 +1,12 @@ +CMake Warning \(dev\) at CMP0030-WARN.cmake:1 \(use_mangled_mesa\): + Policy CMP0030 is not set: The use_mangled_mesa command should not be + called. Run "cmake --help-policy CMP0030" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Error at CMP0030-WARN.cmake:1 \(use_mangled_mesa\): + use_mangled_mesa called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/DisallowedCommands/CMP0030-WARN.cmake b/Tests/RunCMake/DisallowedCommands/CMP0030-WARN.cmake new file mode 100644 index 0000000..cbe0ff0 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0030-WARN.cmake @@ -0,0 +1 @@ +use_mangled_mesa() diff --git a/Tests/RunCMake/DisallowedCommands/CMP0031-NEW-result.txt b/Tests/RunCMake/DisallowedCommands/CMP0031-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0031-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/DisallowedCommands/CMP0031-NEW-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0031-NEW-stderr.txt new file mode 100644 index 0000000..78c2236 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0031-NEW-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at CMP0031-NEW.cmake:2 \(load_command\): + The load_command command should not be called; see CMP0031. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/DisallowedCommands/CMP0031-NEW.cmake b/Tests/RunCMake/DisallowedCommands/CMP0031-NEW.cmake new file mode 100644 index 0000000..3d9caf2 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0031-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0031 NEW) +load_command() diff --git a/Tests/RunCMake/DisallowedCommands/CMP0031-OLD-result.txt b/Tests/RunCMake/DisallowedCommands/CMP0031-OLD-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0031-OLD-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/DisallowedCommands/CMP0031-OLD-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0031-OLD-stderr.txt new file mode 100644 index 0000000..ba198d6 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0031-OLD-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at CMP0031-OLD.cmake:2 \(load_command\): + load_command Attempt to load command failed from file.*bogus_command.* +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/DisallowedCommands/CMP0031-OLD.cmake b/Tests/RunCMake/DisallowedCommands/CMP0031-OLD.cmake new file mode 100644 index 0000000..8fedf98 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0031-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0031 OLD) +load_command(bogus_command) diff --git a/Tests/RunCMake/DisallowedCommands/CMP0031-WARN-result.txt b/Tests/RunCMake/DisallowedCommands/CMP0031-WARN-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0031-WARN-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/DisallowedCommands/CMP0031-WARN-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0031-WARN-stderr.txt new file mode 100644 index 0000000..4cb65b3 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0031-WARN-stderr.txt @@ -0,0 +1,12 @@ +CMake Warning \(dev\) at CMP0031-WARN.cmake:1 \(load_command\): + Policy CMP0031 is not set: The load_command command should not be called. + Run "cmake --help-policy CMP0031" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Error at CMP0031-WARN.cmake:1 \(load_command\): + load_command Attempt to load command failed from file.*bogus_command.* +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/DisallowedCommands/CMP0031-WARN.cmake b/Tests/RunCMake/DisallowedCommands/CMP0031-WARN.cmake new file mode 100644 index 0000000..c9d99fc --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0031-WARN.cmake @@ -0,0 +1 @@ +load_command(bogus_command) diff --git a/Tests/RunCMake/DisallowedCommands/CMP0032-NEW-result.txt b/Tests/RunCMake/DisallowedCommands/CMP0032-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0032-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/DisallowedCommands/CMP0032-NEW-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0032-NEW-stderr.txt new file mode 100644 index 0000000..c7ac16e --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0032-NEW-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at CMP0032-NEW.cmake:2 \(output_required_files\): + The output_required_files command should not be called; see CMP0032. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/DisallowedCommands/CMP0032-NEW.cmake b/Tests/RunCMake/DisallowedCommands/CMP0032-NEW.cmake new file mode 100644 index 0000000..c6fb5e8 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0032-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0032 NEW) +output_required_files() diff --git a/Tests/RunCMake/DisallowedCommands/CMP0032-OLD-result.txt b/Tests/RunCMake/DisallowedCommands/CMP0032-OLD-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0032-OLD-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/DisallowedCommands/CMP0032-OLD-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0032-OLD-stderr.txt new file mode 100644 index 0000000..2223c42 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0032-OLD-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at CMP0032-OLD.cmake:2 \(output_required_files\): + output_required_files called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/DisallowedCommands/CMP0032-OLD.cmake b/Tests/RunCMake/DisallowedCommands/CMP0032-OLD.cmake new file mode 100644 index 0000000..6585110 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0032-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0032 OLD) +output_required_files() diff --git a/Tests/RunCMake/DisallowedCommands/CMP0032-WARN-result.txt b/Tests/RunCMake/DisallowedCommands/CMP0032-WARN-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0032-WARN-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/DisallowedCommands/CMP0032-WARN-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0032-WARN-stderr.txt new file mode 100644 index 0000000..0cf3f94 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0032-WARN-stderr.txt @@ -0,0 +1,12 @@ +CMake Warning \(dev\) at CMP0032-WARN.cmake:1 \(output_required_files\): + Policy CMP0032 is not set: The output_required_files command should not be + called. Run "cmake --help-policy CMP0032" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Error at CMP0032-WARN.cmake:1 \(output_required_files\): + output_required_files called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/DisallowedCommands/CMP0032-WARN.cmake b/Tests/RunCMake/DisallowedCommands/CMP0032-WARN.cmake new file mode 100644 index 0000000..7411e48 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0032-WARN.cmake @@ -0,0 +1 @@ +output_required_files() diff --git a/Tests/RunCMake/DisallowedCommands/CMP0033-NEW-result.txt b/Tests/RunCMake/DisallowedCommands/CMP0033-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0033-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/DisallowedCommands/CMP0033-NEW-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0033-NEW-stderr.txt new file mode 100644 index 0000000..8d210aa --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0033-NEW-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at CMP0033-NEW.cmake:2 \(export_library_dependencies\): + The export_library_dependencies command should not be called; see CMP0033. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/DisallowedCommands/CMP0033-NEW.cmake b/Tests/RunCMake/DisallowedCommands/CMP0033-NEW.cmake new file mode 100644 index 0000000..6f90f29 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0033-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0033 NEW) +export_library_dependencies() diff --git a/Tests/RunCMake/DisallowedCommands/CMP0033-OLD-result.txt b/Tests/RunCMake/DisallowedCommands/CMP0033-OLD-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0033-OLD-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/DisallowedCommands/CMP0033-OLD-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0033-OLD-stderr.txt new file mode 100644 index 0000000..e5dd2dd --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0033-OLD-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at CMP0033-OLD.cmake:2 \(export_library_dependencies\): + export_library_dependencies called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/DisallowedCommands/CMP0033-OLD.cmake b/Tests/RunCMake/DisallowedCommands/CMP0033-OLD.cmake new file mode 100644 index 0000000..a3504b6 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0033-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0033 OLD) +export_library_dependencies() diff --git a/Tests/RunCMake/DisallowedCommands/CMP0033-WARN-result.txt b/Tests/RunCMake/DisallowedCommands/CMP0033-WARN-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0033-WARN-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/DisallowedCommands/CMP0033-WARN-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0033-WARN-stderr.txt new file mode 100644 index 0000000..e561dac --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0033-WARN-stderr.txt @@ -0,0 +1,12 @@ +CMake Warning \(dev\) at CMP0033-WARN.cmake:1 \(export_library_dependencies\): + Policy CMP0033 is not set: The export_library_dependencies command should + not be called. Run "cmake --help-policy CMP0033" for policy details. Use + the cmake_policy command to set the policy and suppress this warning. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Error at CMP0033-WARN.cmake:1 \(export_library_dependencies\): + export_library_dependencies called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/DisallowedCommands/CMP0033-WARN.cmake b/Tests/RunCMake/DisallowedCommands/CMP0033-WARN.cmake new file mode 100644 index 0000000..f897ddd --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0033-WARN.cmake @@ -0,0 +1 @@ +export_library_dependencies() diff --git a/Tests/RunCMake/DisallowedCommands/CMP0034-NEW-result.txt b/Tests/RunCMake/DisallowedCommands/CMP0034-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0034-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/DisallowedCommands/CMP0034-NEW-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0034-NEW-stderr.txt new file mode 100644 index 0000000..1dd279b --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0034-NEW-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at CMP0034-NEW.cmake:2 \(utility_source\): + The utility_source command should not be called; see CMP0034. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/DisallowedCommands/CMP0034-NEW.cmake b/Tests/RunCMake/DisallowedCommands/CMP0034-NEW.cmake new file mode 100644 index 0000000..48724a9 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0034-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0034 NEW) +utility_source() diff --git a/Tests/RunCMake/DisallowedCommands/CMP0034-OLD-result.txt b/Tests/RunCMake/DisallowedCommands/CMP0034-OLD-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0034-OLD-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/DisallowedCommands/CMP0034-OLD-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0034-OLD-stderr.txt new file mode 100644 index 0000000..3358628 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0034-OLD-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at CMP0034-OLD.cmake:2 \(utility_source\): + utility_source called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/DisallowedCommands/CMP0034-OLD.cmake b/Tests/RunCMake/DisallowedCommands/CMP0034-OLD.cmake new file mode 100644 index 0000000..a2c9798 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0034-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0034 OLD) +utility_source() diff --git a/Tests/RunCMake/DisallowedCommands/CMP0034-WARN-result.txt b/Tests/RunCMake/DisallowedCommands/CMP0034-WARN-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0034-WARN-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/DisallowedCommands/CMP0034-WARN-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0034-WARN-stderr.txt new file mode 100644 index 0000000..ea3831f --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0034-WARN-stderr.txt @@ -0,0 +1,12 @@ +CMake Warning \(dev\) at CMP0034-WARN.cmake:1 \(utility_source\): + Policy CMP0034 is not set: The utility_source command should not be called. + Run "cmake --help-policy CMP0034" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Error at CMP0034-WARN.cmake:1 \(utility_source\): + utility_source called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/DisallowedCommands/CMP0034-WARN.cmake b/Tests/RunCMake/DisallowedCommands/CMP0034-WARN.cmake new file mode 100644 index 0000000..b4ae045 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0034-WARN.cmake @@ -0,0 +1 @@ +utility_source() diff --git a/Tests/RunCMake/DisallowedCommands/CMP0035-NEW-result.txt b/Tests/RunCMake/DisallowedCommands/CMP0035-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0035-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/DisallowedCommands/CMP0035-NEW-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0035-NEW-stderr.txt new file mode 100644 index 0000000..0604829 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0035-NEW-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at CMP0035-NEW.cmake:2 \(variable_requires\): + The variable_requires command should not be called; see CMP0035. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/DisallowedCommands/CMP0035-NEW.cmake b/Tests/RunCMake/DisallowedCommands/CMP0035-NEW.cmake new file mode 100644 index 0000000..27eb32e --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0035-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0035 NEW) +variable_requires() diff --git a/Tests/RunCMake/DisallowedCommands/CMP0035-OLD-result.txt b/Tests/RunCMake/DisallowedCommands/CMP0035-OLD-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0035-OLD-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/DisallowedCommands/CMP0035-OLD-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0035-OLD-stderr.txt new file mode 100644 index 0000000..86eda43 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0035-OLD-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at CMP0035-OLD.cmake:2 \(variable_requires\): + variable_requires called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/DisallowedCommands/CMP0035-OLD.cmake b/Tests/RunCMake/DisallowedCommands/CMP0035-OLD.cmake new file mode 100644 index 0000000..7425262 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0035-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0035 OLD) +variable_requires() diff --git a/Tests/RunCMake/DisallowedCommands/CMP0035-WARN-result.txt b/Tests/RunCMake/DisallowedCommands/CMP0035-WARN-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0035-WARN-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/DisallowedCommands/CMP0035-WARN-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0035-WARN-stderr.txt new file mode 100644 index 0000000..4d4fc8e --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0035-WARN-stderr.txt @@ -0,0 +1,12 @@ +CMake Warning \(dev\) at CMP0035-WARN.cmake:1 \(variable_requires\): + Policy CMP0035 is not set: The variable_requires command should not be + called. Run "cmake --help-policy CMP0035" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Error at CMP0035-WARN.cmake:1 \(variable_requires\): + variable_requires called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/DisallowedCommands/CMP0035-WARN.cmake b/Tests/RunCMake/DisallowedCommands/CMP0035-WARN.cmake new file mode 100644 index 0000000..3af4de1 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0035-WARN.cmake @@ -0,0 +1 @@ +variable_requires() diff --git a/Tests/RunCMake/DisallowedCommands/CMP0036-NEW-result.txt b/Tests/RunCMake/DisallowedCommands/CMP0036-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0036-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/DisallowedCommands/CMP0036-NEW-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0036-NEW-stderr.txt new file mode 100644 index 0000000..11aabd0 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0036-NEW-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at CMP0036-NEW.cmake:2 \(build_name\): + The build_name command should not be called; see CMP0036. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/DisallowedCommands/CMP0036-NEW.cmake b/Tests/RunCMake/DisallowedCommands/CMP0036-NEW.cmake new file mode 100644 index 0000000..5341db2 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0036-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0036 NEW) +build_name() diff --git a/Tests/RunCMake/DisallowedCommands/CMP0036-OLD-result.txt b/Tests/RunCMake/DisallowedCommands/CMP0036-OLD-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0036-OLD-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/DisallowedCommands/CMP0036-OLD-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0036-OLD-stderr.txt new file mode 100644 index 0000000..fef195f --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0036-OLD-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at CMP0036-OLD.cmake:2 \(build_name\): + build_name called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/DisallowedCommands/CMP0036-OLD.cmake b/Tests/RunCMake/DisallowedCommands/CMP0036-OLD.cmake new file mode 100644 index 0000000..fdd840f --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0036-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0036 OLD) +build_name() diff --git a/Tests/RunCMake/DisallowedCommands/CMP0036-WARN-result.txt b/Tests/RunCMake/DisallowedCommands/CMP0036-WARN-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0036-WARN-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/DisallowedCommands/CMP0036-WARN-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0036-WARN-stderr.txt new file mode 100644 index 0000000..b9b7c5a --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0036-WARN-stderr.txt @@ -0,0 +1,12 @@ +CMake Warning \(dev\) at CMP0036-WARN.cmake:1 \(build_name\): + Policy CMP0036 is not set: The build_name command should not be called. + Run "cmake --help-policy CMP0036" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Error at CMP0036-WARN.cmake:1 \(build_name\): + build_name called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/DisallowedCommands/CMP0036-WARN.cmake b/Tests/RunCMake/DisallowedCommands/CMP0036-WARN.cmake new file mode 100644 index 0000000..9556687 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMP0036-WARN.cmake @@ -0,0 +1 @@ +build_name() diff --git a/Tests/RunCMake/DisallowedCommands/CMakeLists.txt b/Tests/RunCMake/DisallowedCommands/CMakeLists.txt new file mode 100644 index 0000000..12cd3c7 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.4) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/DisallowedCommands/RunCMakeTest.cmake b/Tests/RunCMake/DisallowedCommands/RunCMakeTest.cmake new file mode 100644 index 0000000..208ea20 --- /dev/null +++ b/Tests/RunCMake/DisallowedCommands/RunCMakeTest.cmake @@ -0,0 +1,16 @@ +include(RunCMake) + +foreach(p + CMP0029 + CMP0030 + CMP0031 + CMP0032 + CMP0033 + CMP0034 + CMP0035 + CMP0036 + ) + run_cmake(${p}-WARN) + run_cmake(${p}-OLD) + run_cmake(${p}-NEW) +endforeach() diff --git a/Tests/RunCMake/ExportWithoutLanguage/NoLanguage-stderr.txt b/Tests/RunCMake/ExportWithoutLanguage/NoLanguage-stderr.txt index 67a0ae3..5658d85 100644 --- a/Tests/RunCMake/ExportWithoutLanguage/NoLanguage-stderr.txt +++ b/Tests/RunCMake/ExportWithoutLanguage/NoLanguage-stderr.txt @@ -1,6 +1,4 @@ CMake Error: CMake can not determine linker language for target: NoLanguage -CMake Error at NoLanguage.cmake:2 \(export\): +CMake Error in CMakeLists.txt: Exporting the target "NoLanguage" is not allowed since its linker language cannot be determined -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExportWithoutLanguage/header.h b/Tests/RunCMake/ExportWithoutLanguage/header.h new file mode 100644 index 0000000..0c803ed --- /dev/null +++ b/Tests/RunCMake/ExportWithoutLanguage/header.h @@ -0,0 +1,2 @@ + +enum some_compilers { need_more_than_nothing }; diff --git a/Tests/RunCMake/ExternalData/NoURLTemplates-stderr.txt b/Tests/RunCMake/ExternalData/NoURLTemplates-stderr.txt index ad059d4..ccbaf5a 100644 --- a/Tests/RunCMake/ExternalData/NoURLTemplates-stderr.txt +++ b/Tests/RunCMake/ExternalData/NoURLTemplates-stderr.txt @@ -1,5 +1,5 @@ CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): - ExternalData_URL_TEMPLATES is not set! + Neither ExternalData_URL_TEMPLATES nor ExternalData_OBJECT_STORES is set! Call Stack \(most recent call first\): NoURLTemplates.cmake:2 \(ExternalData_Add_Target\) CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/ObjectStoreOnly.cmake b/Tests/RunCMake/ExternalData/ObjectStoreOnly.cmake new file mode 100644 index 0000000..5e66101 --- /dev/null +++ b/Tests/RunCMake/ExternalData/ObjectStoreOnly.cmake @@ -0,0 +1,3 @@ +include(ExternalData) +set(ExternalData_OBJECT_STORES "${CMAKE_CURRENT_BINARY_DIR}") +ExternalData_Add_Target(Data) diff --git a/Tests/RunCMake/ExternalData/RunCMakeTest.cmake b/Tests/RunCMake/ExternalData/RunCMakeTest.cmake index 8fba82c..93ff08f 100644 --- a/Tests/RunCMake/ExternalData/RunCMakeTest.cmake +++ b/Tests/RunCMake/ExternalData/RunCMakeTest.cmake @@ -22,6 +22,7 @@ run_cmake(NormalData2) run_cmake(NormalData3) run_cmake(NormalDataSub1) run_cmake(NotUnderRoot) +run_cmake(ObjectStoreOnly) run_cmake(Semicolon1) run_cmake(Semicolon2) run_cmake(Semicolon3) diff --git a/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt index 1cfbf40..964ea4d 100644 --- a/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt @@ -1,15 +1,6 @@ CMake Error at BadCONFIG.cmake:1 \(add_custom_target\): Error evaluating generator expression: - \$<CONFIG> - - \$<CONFIG> expression requires exactly one parameter. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) -+ -CMake Error at BadCONFIG.cmake:1 \(add_custom_target\): - Error evaluating generator expression: - \$<CONFIG:.> Expression syntax not recognized. @@ -21,7 +12,7 @@ CMake Error at BadCONFIG.cmake:1 \(add_custom_target\): \$<CONFIG:Foo,Bar> - \$<CONFIG> expression requires exactly one parameter. + \$<CONFIG> expression requires one or zero parameters. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + diff --git a/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake b/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake index c27ea5f..5c22aaa 100644 --- a/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake +++ b/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake @@ -1,5 +1,4 @@ add_custom_target(check ALL COMMAND check - $<CONFIG> $<CONFIG:.> $<CONFIG:Foo,Bar> $<CONFIG:Foo-Bar> diff --git a/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject-result.txt b/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject-stderr.txt new file mode 100644 index 0000000..533d38c --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject-stderr.txt @@ -0,0 +1,26 @@ +CMake Error at BadTargetTypeObject.cmake:3 \(add_custom_target\): + Error evaluating generator expression: + + \$<TARGET_FILE:objlib> + + Target "objlib" is not an executable or library. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadTargetTypeObject.cmake:3 \(add_custom_target\): + Error evaluating generator expression: + + \$<TARGET_SONAME_FILE:objlib> + + Target "objlib" is not an executable or library. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadTargetTypeObject.cmake:3 \(add_custom_target\): + Error evaluating generator expression: + + \$<TARGET_LINKER_FILE:objlib> + + Target "objlib" is not an executable or library. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject.cmake b/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject.cmake new file mode 100644 index 0000000..c47ee2b --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject.cmake @@ -0,0 +1,7 @@ +enable_language(C) +add_library(objlib OBJECT empty.c) +add_custom_target(check ALL COMMAND echo + $<TARGET_FILE:objlib> + $<TARGET_SONAME_FILE:objlib> + $<TARGET_LINKER_FILE:objlib> + ) diff --git a/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-result.txt b/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-stderr.txt b/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-stderr.txt new file mode 100644 index 0000000..2079c12 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-stderr.txt @@ -0,0 +1,7 @@ +CMake Warning \(dev\) at CMP0044-WARN.cmake:13 \(target_compile_definitions\): + Policy CMP0044 is not set: Case sensitive <LANG>_COMPILER_ID generator + expressions. Run "cmake --help-policy CMP0044" for policy details. Use + the cmake_policy command to set the policy and suppress this warning. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/GeneratorExpression/CMP0044-WARN.cmake b/Tests/RunCMake/GeneratorExpression/CMP0044-WARN.cmake new file mode 100644 index 0000000..d5b85c9 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/CMP0044-WARN.cmake @@ -0,0 +1,17 @@ + +project(CMP0044-WARN) + +string(TOLOWER ${CMAKE_C_COMPILER_ID} lc_test) +if (lc_test STREQUAL CMAKE_C_COMPILER_ID) + string(TOUPPER ${CMAKE_C_COMPILER_ID} lc_test) + if (lc_test STREQUAL CMAKE_C_COMPILER_ID) + message(SEND_ERROR "Try harder.") + endif() +endif() + +add_library(cmp0044-check empty.c) +target_compile_definitions(cmp0044-check + PRIVATE + Result=$<C_COMPILER_ID:${lc_test}> + Type_Is_${CMP0044_TYPE} +) diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index 62bf29b..f3f99ed 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -7,4 +7,6 @@ run_cmake(BadNOT) run_cmake(BadStrEqual) run_cmake(BadZero) run_cmake(BadTargetName) +run_cmake(BadTargetTypeObject) run_cmake(BadInstallPrefix) +run_cmake(CMP0044-WARN) diff --git a/Tests/RunCMake/GeneratorExpression/empty.c b/Tests/RunCMake/GeneratorExpression/empty.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/empty.c diff --git a/Tests/RunCMake/ObjectLibrary/ExportLanguages.cmake b/Tests/RunCMake/ObjectLibrary/ExportLanguages.cmake deleted file mode 100644 index 0796c21..0000000 --- a/Tests/RunCMake/ObjectLibrary/ExportLanguages.cmake +++ /dev/null @@ -1,15 +0,0 @@ -enable_language(CXX) -add_library(A OBJECT a.cxx) -add_library(B STATIC a.c $<TARGET_OBJECTS:A>) - -# Verify that object library languages are propagated. -export(TARGETS B NAMESPACE Exp FILE BExport.cmake) -include(${CMAKE_CURRENT_BINARY_DIR}/BExport.cmake) -get_property(configs TARGET ExpB PROPERTY IMPORTED_CONFIGURATIONS) -foreach(c ${configs}) - get_property(langs TARGET ExpB PROPERTY IMPORTED_LINK_INTERFACE_LANGUAGES_${c}) - list(FIND langs CXX pos) - if(${pos} LESS 0) - message(FATAL_ERROR "Target export does not list object library languages.") - endif() -endforeach() diff --git a/Tests/RunCMake/ObjectLibrary/MissingSource-result.txt b/Tests/RunCMake/ObjectLibrary/MissingSource-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/MissingSource-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ObjectLibrary/MissingSource-stderr.txt b/Tests/RunCMake/ObjectLibrary/MissingSource-stderr.txt new file mode 100644 index 0000000..411cd7c --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/MissingSource-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at MissingSource.cmake:1 \(add_library\): + Cannot find source file: + + missing.c + + Tried extensions( \.[A-Za-z+]+| + )* +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ObjectLibrary/MissingSource.cmake b/Tests/RunCMake/ObjectLibrary/MissingSource.cmake new file mode 100644 index 0000000..258eaed --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/MissingSource.cmake @@ -0,0 +1 @@ +add_library(A OBJECT missing.c) diff --git a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake index 55db14d..42973f8 100644 --- a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake +++ b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake @@ -6,12 +6,12 @@ run_cmake(BadSourceExpression3) run_cmake(BadObjSource1) run_cmake(BadObjSource2) run_cmake(Export) -run_cmake(ExportLanguages) run_cmake(Import) run_cmake(Install) run_cmake(LinkObjLHS) run_cmake(LinkObjRHS1) run_cmake(LinkObjRHS2) +run_cmake(MissingSource) run_cmake(ObjWithObj) run_cmake(PostBuild) run_cmake(PreBuild) diff --git a/Tests/RunCMake/ObsoleteQtMacros/AutomocMacro-WARN-stderr.txt b/Tests/RunCMake/ObsoleteQtMacros/AutomocMacro-WARN-stderr.txt index 6f7e8ee..f358cc4 100644 --- a/Tests/RunCMake/ObsoleteQtMacros/AutomocMacro-WARN-stderr.txt +++ b/Tests/RunCMake/ObsoleteQtMacros/AutomocMacro-WARN-stderr.txt @@ -1,4 +1,4 @@ -CMake Warning at .*/Modules/Qt4Macros.cmake:[^ ]+ \(message\): +CMake Deprecation Warning at .*/Modules/Qt4Macros.cmake:[^ ]+ \(message\): The qt4_automoc macro is obsolete. Use the CMAKE_AUTOMOC feature instead. Call Stack \(most recent call first\): AutomocMacro-WARN.cmake:7 \(qt4_automoc\) diff --git a/Tests/RunCMake/ObsoleteQtMacros/UseModulesMacro-WARN-stderr.txt b/Tests/RunCMake/ObsoleteQtMacros/UseModulesMacro-WARN-stderr.txt index b90c665..c69af65 100644 --- a/Tests/RunCMake/ObsoleteQtMacros/UseModulesMacro-WARN-stderr.txt +++ b/Tests/RunCMake/ObsoleteQtMacros/UseModulesMacro-WARN-stderr.txt @@ -1,4 +1,4 @@ -CMake Warning at .*/Modules/Qt4Macros.cmake:[^ ]+ \(message\): +CMake Deprecation Warning at .*/Modules/Qt4Macros.cmake:[^ ]+ \(message\): The qt4_use_modules function is obsolete. Use target_link_libraries with IMPORTED targets instead. Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/PositionIndependentCode/Conflict4-result.txt b/Tests/RunCMake/PositionIndependentCode/Conflict4-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/PositionIndependentCode/Conflict4-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/PositionIndependentCode/Conflict4-stderr.txt b/Tests/RunCMake/PositionIndependentCode/Conflict4-stderr.txt new file mode 100644 index 0000000..76d5ea0 --- /dev/null +++ b/Tests/RunCMake/PositionIndependentCode/Conflict4-stderr.txt @@ -0,0 +1,4 @@ +CMake Error: Property POSITION_INDEPENDENT_CODE on target "conflict" is +implied to be FALSE because it was used to determine the link libraries +already. The INTERFACE_POSITION_INDEPENDENT_CODE property on +dependency "picon" is in conflict. diff --git a/Tests/RunCMake/PositionIndependentCode/Conflict4.cmake b/Tests/RunCMake/PositionIndependentCode/Conflict4.cmake new file mode 100644 index 0000000..ff5dfb3 --- /dev/null +++ b/Tests/RunCMake/PositionIndependentCode/Conflict4.cmake @@ -0,0 +1,8 @@ + +add_library(piciface INTERFACE) + +add_library(picon INTERFACE) +set_property(TARGET picon PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE ON) + +add_executable(conflict "main.cpp") +target_link_libraries(conflict picon $<$<BOOL:$<TARGET_PROPERTY:POSITION_INDEPENDENT_CODE>>:piciface>) diff --git a/Tests/RunCMake/PositionIndependentCode/Conflict5-result.txt b/Tests/RunCMake/PositionIndependentCode/Conflict5-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/PositionIndependentCode/Conflict5-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/PositionIndependentCode/Conflict5-stderr.txt b/Tests/RunCMake/PositionIndependentCode/Conflict5-stderr.txt new file mode 100644 index 0000000..ecd0492 --- /dev/null +++ b/Tests/RunCMake/PositionIndependentCode/Conflict5-stderr.txt @@ -0,0 +1,3 @@ +CMake Error: The INTERFACE_POSITION_INDEPENDENT_CODE property of "picoff" does +not agree with the value of POSITION_INDEPENDENT_CODE already determined +for "conflict". diff --git a/Tests/RunCMake/PositionIndependentCode/Conflict5.cmake b/Tests/RunCMake/PositionIndependentCode/Conflict5.cmake new file mode 100644 index 0000000..e6055f4 --- /dev/null +++ b/Tests/RunCMake/PositionIndependentCode/Conflict5.cmake @@ -0,0 +1,9 @@ + +add_library(picon INTERFACE) +set_property(TARGET picon PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE ON) + +add_library(picoff INTERFACE) +set_property(TARGET picoff PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE OFF) + +add_executable(conflict "main.cpp") +target_link_libraries(conflict picon picoff) diff --git a/Tests/RunCMake/PositionIndependentCode/Conflict6-result.txt b/Tests/RunCMake/PositionIndependentCode/Conflict6-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/PositionIndependentCode/Conflict6-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/PositionIndependentCode/Conflict6-stderr.txt b/Tests/RunCMake/PositionIndependentCode/Conflict6-stderr.txt new file mode 100644 index 0000000..0254e55 --- /dev/null +++ b/Tests/RunCMake/PositionIndependentCode/Conflict6-stderr.txt @@ -0,0 +1,4 @@ +Property POSITION_INDEPENDENT_CODE on target "conflict" is +implied to be FALSE because it was used to determine the link libraries +already. The INTERFACE_POSITION_INDEPENDENT_CODE property on +dependency "picon" is in conflict. diff --git a/Tests/RunCMake/PositionIndependentCode/Conflict6.cmake b/Tests/RunCMake/PositionIndependentCode/Conflict6.cmake new file mode 100644 index 0000000..7ea7c5f --- /dev/null +++ b/Tests/RunCMake/PositionIndependentCode/Conflict6.cmake @@ -0,0 +1,8 @@ + +add_library(picoff INTERFACE) + +add_library(picon INTERFACE) +set_property(TARGET picon PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE ON) + +add_executable(conflict "main.cpp") +target_link_libraries(conflict picon $<$<NOT:$<BOOL:$<TARGET_PROPERTY:POSITION_INDEPENDENT_CODE>>>:picoff>) diff --git a/Tests/RunCMake/PositionIndependentCode/Debug-result.txt b/Tests/RunCMake/PositionIndependentCode/Debug-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/PositionIndependentCode/Debug-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/PositionIndependentCode/Debug-stderr.txt b/Tests/RunCMake/PositionIndependentCode/Debug-stderr.txt new file mode 100644 index 0000000..774445b --- /dev/null +++ b/Tests/RunCMake/PositionIndependentCode/Debug-stderr.txt @@ -0,0 +1,6 @@ +CMake Debug Log: + Boolean compatibility of property "POSITION_INDEPENDENT_CODE" for target + "foo" \(result: "TRUE"\): + + \* Target "foo" has property content "TRUE" + \* Target "iface" property value "TRUE" \(Agree\) diff --git a/Tests/RunCMake/PositionIndependentCode/Debug.cmake b/Tests/RunCMake/PositionIndependentCode/Debug.cmake new file mode 100644 index 0000000..4a8fbac --- /dev/null +++ b/Tests/RunCMake/PositionIndependentCode/Debug.cmake @@ -0,0 +1,8 @@ + +add_library(iface INTERFACE) +set_property(TARGET iface PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE ON) + +set(CMAKE_DEBUG_TARGET_PROPERTIES POSITION_INDEPENDENT_CODE) +add_library(foo main.cpp) +target_link_libraries(foo iface) +set_property(TARGET foo PROPERTY POSITION_INDEPENDENT_CODE ON) diff --git a/Tests/RunCMake/PositionIndependentCode/RunCMakeTest.cmake b/Tests/RunCMake/PositionIndependentCode/RunCMakeTest.cmake index 64a340c..6a67e3c 100644 --- a/Tests/RunCMake/PositionIndependentCode/RunCMakeTest.cmake +++ b/Tests/RunCMake/PositionIndependentCode/RunCMakeTest.cmake @@ -3,3 +3,7 @@ include(RunCMake) run_cmake(Conflict1) run_cmake(Conflict2) run_cmake(Conflict3) +run_cmake(Conflict4) +run_cmake(Conflict5) +run_cmake(Conflict6) +run_cmake(Debug) diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 00faa4c..5c7c05c 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -36,6 +36,9 @@ function(run_cmake test) if(NOT DEFINED RunCMake_TEST_OPTIONS) set(RunCMake_TEST_OPTIONS "") endif() + if(APPLE) + list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0025=NEW) + endif() execute_process( COMMAND ${CMAKE_COMMAND} "${RunCMake_TEST_SOURCE_DIR}" -G "${RunCMake_GENERATOR}" @@ -52,6 +55,7 @@ function(run_cmake test) set(msg "${msg}Result is [${actual_result}], not [${expect_result}].\n") endif() foreach(o out err) + string(REGEX REPLACE "(^|\n)(==[0-9]+==[^\n]*\n)+" "\\1" actual_std${o} "${actual_std${o}}") string(REGEX REPLACE "\n+$" "" actual_std${o} "${actual_std${o}}") set(expect_${o} "") if(DEFINED expect_std${o}) diff --git a/Tests/RunCMake/Syntax/.gitattributes b/Tests/RunCMake/Syntax/.gitattributes index fc9ebff..35a9eaf 100644 --- a/Tests/RunCMake/Syntax/.gitattributes +++ b/Tests/RunCMake/Syntax/.gitattributes @@ -1 +1,3 @@ CommandTabs.cmake whitespace=-tab-in-indent +StringCRLF.cmake whitespace=cr-at-eol -crlf +BracketCRLF.cmake whitespace=cr-at-eol -crlf diff --git a/Tests/RunCMake/Syntax/BOM-UTF-16-BE-result.txt b/Tests/RunCMake/Syntax/BOM-UTF-16-BE-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/BOM-UTF-16-BE-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/BOM-UTF-16-BE-stderr.txt b/Tests/RunCMake/Syntax/BOM-UTF-16-BE-stderr.txt new file mode 100644 index 0000000..b3f1e47 --- /dev/null +++ b/Tests/RunCMake/Syntax/BOM-UTF-16-BE-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at CMakeLists.txt:3 \(include\): + File + + .*/Tests/RunCMake/Syntax/BOM-UTF-16-BE.cmake + + starts with a Byte-Order-Mark that is not UTF-8. diff --git a/Tests/RunCMake/Syntax/BOM-UTF-16-BE.cmake b/Tests/RunCMake/Syntax/BOM-UTF-16-BE.cmake Binary files differnew file mode 100644 index 0000000..c51f6e6 --- /dev/null +++ b/Tests/RunCMake/Syntax/BOM-UTF-16-BE.cmake diff --git a/Tests/RunCMake/Syntax/BOM-UTF-16-LE-result.txt b/Tests/RunCMake/Syntax/BOM-UTF-16-LE-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/BOM-UTF-16-LE-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/BOM-UTF-16-LE-stderr.txt b/Tests/RunCMake/Syntax/BOM-UTF-16-LE-stderr.txt new file mode 100644 index 0000000..c08c902 --- /dev/null +++ b/Tests/RunCMake/Syntax/BOM-UTF-16-LE-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at CMakeLists.txt:3 \(include\): + File + + .*/Tests/RunCMake/Syntax/BOM-UTF-16-LE.cmake + + starts with a Byte-Order-Mark that is not UTF-8. diff --git a/Tests/RunCMake/Syntax/BOM-UTF-16-LE.cmake b/Tests/RunCMake/Syntax/BOM-UTF-16-LE.cmake Binary files differnew file mode 100644 index 0000000..b57446f --- /dev/null +++ b/Tests/RunCMake/Syntax/BOM-UTF-16-LE.cmake diff --git a/Tests/RunCMake/Syntax/BOM-UTF-32-BE-result.txt b/Tests/RunCMake/Syntax/BOM-UTF-32-BE-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/BOM-UTF-32-BE-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/BOM-UTF-32-BE-stderr.txt b/Tests/RunCMake/Syntax/BOM-UTF-32-BE-stderr.txt new file mode 100644 index 0000000..5dde4e3 --- /dev/null +++ b/Tests/RunCMake/Syntax/BOM-UTF-32-BE-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at CMakeLists.txt:3 \(include\): + File + + .*/Tests/RunCMake/Syntax/BOM-UTF-32-BE.cmake + + starts with a Byte-Order-Mark that is not UTF-8. diff --git a/Tests/RunCMake/Syntax/BOM-UTF-32-BE.cmake b/Tests/RunCMake/Syntax/BOM-UTF-32-BE.cmake Binary files differnew file mode 100644 index 0000000..23c57f3 --- /dev/null +++ b/Tests/RunCMake/Syntax/BOM-UTF-32-BE.cmake diff --git a/Tests/RunCMake/Syntax/BOM-UTF-32-LE-result.txt b/Tests/RunCMake/Syntax/BOM-UTF-32-LE-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/BOM-UTF-32-LE-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/BOM-UTF-32-LE-stderr.txt b/Tests/RunCMake/Syntax/BOM-UTF-32-LE-stderr.txt new file mode 100644 index 0000000..eb054ec --- /dev/null +++ b/Tests/RunCMake/Syntax/BOM-UTF-32-LE-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at CMakeLists.txt:3 \(include\): + File + + .*/Tests/RunCMake/Syntax/BOM-UTF-32-LE.cmake + + starts with a Byte-Order-Mark that is not UTF-8. diff --git a/Tests/RunCMake/Syntax/BOM-UTF-32-LE.cmake b/Tests/RunCMake/Syntax/BOM-UTF-32-LE.cmake Binary files differnew file mode 100644 index 0000000..c330f5b --- /dev/null +++ b/Tests/RunCMake/Syntax/BOM-UTF-32-LE.cmake diff --git a/Tests/RunCMake/Syntax/BOM-UTF-8-stdout.txt b/Tests/RunCMake/Syntax/BOM-UTF-8-stdout.txt new file mode 100644 index 0000000..5776d6e --- /dev/null +++ b/Tests/RunCMake/Syntax/BOM-UTF-8-stdout.txt @@ -0,0 +1 @@ +-- message diff --git a/Tests/RunCMake/Syntax/BOM-UTF-8.cmake b/Tests/RunCMake/Syntax/BOM-UTF-8.cmake new file mode 100644 index 0000000..bdff83b --- /dev/null +++ b/Tests/RunCMake/Syntax/BOM-UTF-8.cmake @@ -0,0 +1 @@ +message(STATUS "message") diff --git a/Tests/RunCMake/Syntax/Bracket0-stderr.txt b/Tests/RunCMake/Syntax/Bracket0-stderr.txt new file mode 100644 index 0000000..39cc2bc --- /dev/null +++ b/Tests/RunCMake/Syntax/Bracket0-stderr.txt @@ -0,0 +1 @@ +^1 \${var} \\n 4$ diff --git a/Tests/RunCMake/Syntax/Bracket0.cmake b/Tests/RunCMake/Syntax/Bracket0.cmake new file mode 100644 index 0000000..4bc0172 --- /dev/null +++ b/Tests/RunCMake/Syntax/Bracket0.cmake @@ -0,0 +1 @@ +message([[1 ${var} \n 4]]) diff --git a/Tests/RunCMake/Syntax/Bracket1-stderr.txt b/Tests/RunCMake/Syntax/Bracket1-stderr.txt new file mode 100644 index 0000000..e1e13c1 --- /dev/null +++ b/Tests/RunCMake/Syntax/Bracket1-stderr.txt @@ -0,0 +1 @@ +^1 \${var} \\n 4\]==$ diff --git a/Tests/RunCMake/Syntax/Bracket1.cmake b/Tests/RunCMake/Syntax/Bracket1.cmake new file mode 100644 index 0000000..587a575 --- /dev/null +++ b/Tests/RunCMake/Syntax/Bracket1.cmake @@ -0,0 +1,2 @@ +message([==[1 ]==] [=[ +${var} \n 4]==]=]) diff --git a/Tests/RunCMake/Syntax/Bracket2-stdout.txt b/Tests/RunCMake/Syntax/Bracket2-stdout.txt new file mode 100644 index 0000000..0f8aa2f --- /dev/null +++ b/Tests/RunCMake/Syntax/Bracket2-stdout.txt @@ -0,0 +1,2 @@ +-- Bracket Argument 1 +-- Bracket Argument 2 diff --git a/Tests/RunCMake/Syntax/Bracket2.cmake b/Tests/RunCMake/Syntax/Bracket2.cmake new file mode 100644 index 0000000..5c5feed --- /dev/null +++ b/Tests/RunCMake/Syntax/Bracket2.cmake @@ -0,0 +1,2 @@ +message(STATUS [[Bracket Argument 1]] #[[Bracket Comment 1]]) +message(STATUS #[[Bracket Comment 2]] [[Bracket Argument 2]]) diff --git a/Tests/RunCMake/Syntax/BracketBackslash-result.txt b/Tests/RunCMake/Syntax/BracketBackslash-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketBackslash-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/BracketBackslash-stderr.txt b/Tests/RunCMake/Syntax/BracketBackslash-stderr.txt new file mode 100644 index 0000000..b746953 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketBackslash-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at BracketBackslash.cmake:1 \(message\): + a\\ + + b +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/BracketBackslash.cmake b/Tests/RunCMake/Syntax/BracketBackslash.cmake new file mode 100644 index 0000000..5478e5d --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketBackslash.cmake @@ -0,0 +1,2 @@ +message(FATAL_ERROR [==[a\ +b]==]) diff --git a/Tests/RunCMake/Syntax/BracketCRLF-stderr.txt b/Tests/RunCMake/Syntax/BracketCRLF-stderr.txt new file mode 100644 index 0000000..7aef26e --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketCRLF-stderr.txt @@ -0,0 +1 @@ +CRLF->LF worked diff --git a/Tests/RunCMake/Syntax/BracketCRLF.cmake b/Tests/RunCMake/Syntax/BracketCRLF.cmake new file mode 100644 index 0000000..bda0e17 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketCRLF.cmake @@ -0,0 +1,8 @@ +if([[
+]] STREQUAL "" AND
+[[a
+b]] STREQUAL "a\nb")
+ message("CRLF->LF worked")
+else()
+ message(FATAL_ERROR "CRLF->LF failed")
+endif()
diff --git a/Tests/RunCMake/Syntax/BracketComment0-stdout.txt b/Tests/RunCMake/Syntax/BracketComment0-stdout.txt new file mode 100644 index 0000000..c9c0be4 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketComment0-stdout.txt @@ -0,0 +1 @@ +-- The above FATAL_ERROR did not occur. diff --git a/Tests/RunCMake/Syntax/BracketComment0.cmake b/Tests/RunCMake/Syntax/BracketComment0.cmake new file mode 100644 index 0000000..0ee95de --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketComment0.cmake @@ -0,0 +1,5 @@ +#[=[ +#]] +message(FATAL_ERROR "This is commented out.") +#]==]=] +message(STATUS "The above FATAL_ERROR did not occur.") diff --git a/Tests/RunCMake/Syntax/BracketComment1-result.txt b/Tests/RunCMake/Syntax/BracketComment1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketComment1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/BracketComment1-stderr.txt b/Tests/RunCMake/Syntax/BracketComment1-stderr.txt new file mode 100644 index 0000000..a9373de --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketComment1-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at BracketComment1.cmake:2 \(message\): + This is not commented out. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/BracketComment1.cmake b/Tests/RunCMake/Syntax/BracketComment1.cmake new file mode 100644 index 0000000..2ec9d20 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketComment1.cmake @@ -0,0 +1,3 @@ +##[[ +message(FATAL_ERROR "This is not commented out.") +#]] diff --git a/Tests/RunCMake/Syntax/BracketComment2-result.txt b/Tests/RunCMake/Syntax/BracketComment2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketComment2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/BracketComment2-stderr.txt b/Tests/RunCMake/Syntax/BracketComment2-stderr.txt new file mode 100644 index 0000000..7e98222 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketComment2-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at BracketComment2.cmake:2 \(message\): + This is not commented out. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/BracketComment2.cmake b/Tests/RunCMake/Syntax/BracketComment2.cmake new file mode 100644 index 0000000..3eda32d --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketComment2.cmake @@ -0,0 +1,3 @@ +# [[ +message(FATAL_ERROR "This is not commented out.") +#]] diff --git a/Tests/RunCMake/Syntax/BracketComment3-stdout.txt b/Tests/RunCMake/Syntax/BracketComment3-stdout.txt new file mode 100644 index 0000000..c9c0be4 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketComment3-stdout.txt @@ -0,0 +1 @@ +-- The above FATAL_ERROR did not occur. diff --git a/Tests/RunCMake/Syntax/BracketComment3.cmake b/Tests/RunCMake/Syntax/BracketComment3.cmake new file mode 100644 index 0000000..ffd03a9 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketComment3.cmake @@ -0,0 +1,4 @@ +#[[Text on opening line +message(FATAL_ERROR "This is commented out.") +#]=]] +message(STATUS "The above FATAL_ERROR did not occur.") diff --git a/Tests/RunCMake/Syntax/BracketComment4-result.txt b/Tests/RunCMake/Syntax/BracketComment4-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketComment4-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/BracketComment4-stderr.txt b/Tests/RunCMake/Syntax/BracketComment4-stderr.txt new file mode 100644 index 0000000..8ba32c2 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketComment4-stderr.txt @@ -0,0 +1,7 @@ +CMake Error: Error in cmake code at +.*/Tests/RunCMake/Syntax/BracketComment4.cmake:3: +Parse error. Expected a newline, got identifier with text "message". +CMake Error at CMakeLists.txt:3 \(include\): + include could not find load file: + + BracketComment4.cmake diff --git a/Tests/RunCMake/Syntax/BracketComment4.cmake b/Tests/RunCMake/Syntax/BracketComment4.cmake new file mode 100644 index 0000000..9d586f1 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketComment4.cmake @@ -0,0 +1,3 @@ +#[[ +message(FATAL_ERROR "This is commented out.") +#]] message(STATUS "This command not allowed here") diff --git a/Tests/RunCMake/Syntax/BracketComment5-stdout.txt b/Tests/RunCMake/Syntax/BracketComment5-stdout.txt new file mode 100644 index 0000000..c9c0be4 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketComment5-stdout.txt @@ -0,0 +1 @@ +-- The above FATAL_ERROR did not occur. diff --git a/Tests/RunCMake/Syntax/BracketComment5.cmake b/Tests/RunCMake/Syntax/BracketComment5.cmake new file mode 100644 index 0000000..dc9e6b4 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketComment5.cmake @@ -0,0 +1,11 @@ +#[[ +message(FATAL_ERROR "This is commented out.") +#]] #[[ +message(FATAL_ERROR "This is commented out.") +#]]#[[ +message(FATAL_ERROR "This is commented out.") +#]] #message(FATAL_ERROR "This is commented out.") +#[[ +message(FATAL_ERROR "This is commented out.") +#]]#message(FATAL_ERROR "This is commented out.") +message(STATUS "The above FATAL_ERROR did not occur.") diff --git a/Tests/RunCMake/Syntax/BracketNoSpace0-result.txt b/Tests/RunCMake/Syntax/BracketNoSpace0-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace0-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/BracketNoSpace0-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace0-stderr.txt new file mode 100644 index 0000000..afd91f9 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace0-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at CMakeLists.txt:3 \(include\): + Syntax Error in cmake code at + + .*/Tests/RunCMake/Syntax/BracketNoSpace0.cmake:1:27 + + Argument not separated from preceding token by whitespace. diff --git a/Tests/RunCMake/Syntax/BracketNoSpace0.cmake b/Tests/RunCMake/Syntax/BracketNoSpace0.cmake new file mode 100644 index 0000000..1de1450 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace0.cmake @@ -0,0 +1 @@ +message(STATUS [[bracket]]unquoted) diff --git a/Tests/RunCMake/Syntax/BracketNoSpace1-result.txt b/Tests/RunCMake/Syntax/BracketNoSpace1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/BracketNoSpace1-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace1-stderr.txt new file mode 100644 index 0000000..826e511 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace1-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at CMakeLists.txt:3 \(include\): + Syntax Error in cmake code at + + .*/Tests/RunCMake/Syntax/BracketNoSpace1.cmake:1:24 + + Argument not separated from preceding token by whitespace. diff --git a/Tests/RunCMake/Syntax/BracketNoSpace1.cmake b/Tests/RunCMake/Syntax/BracketNoSpace1.cmake new file mode 100644 index 0000000..7982bf3 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace1.cmake @@ -0,0 +1 @@ +message(STATUS "string"[[bracket]]) diff --git a/Tests/RunCMake/Syntax/BracketNoSpace2-result.txt b/Tests/RunCMake/Syntax/BracketNoSpace2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/BracketNoSpace2-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace2-stderr.txt new file mode 100644 index 0000000..23ecdcd --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace2-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at CMakeLists.txt:3 \(include\): + Syntax Error in cmake code at + + .*/Tests/RunCMake/Syntax/BracketNoSpace2.cmake:1:44 + + Argument not separated from preceding token by whitespace. diff --git a/Tests/RunCMake/Syntax/BracketNoSpace2.cmake b/Tests/RunCMake/Syntax/BracketNoSpace2.cmake new file mode 100644 index 0000000..f1507f3 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace2.cmake @@ -0,0 +1 @@ +message(STATUS "string"#[[bracket comment]][[bracket]]) diff --git a/Tests/RunCMake/Syntax/BracketNoSpace3-result.txt b/Tests/RunCMake/Syntax/BracketNoSpace3-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/BracketNoSpace3-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace3-stderr.txt new file mode 100644 index 0000000..906d6fc --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace3-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at CMakeLists.txt:3 \(include\): + Syntax Error in cmake code at + + .*/Tests/RunCMake/Syntax/BracketNoSpace3.cmake:1:45 + + Argument not separated from preceding token by whitespace. diff --git a/Tests/RunCMake/Syntax/BracketNoSpace3.cmake b/Tests/RunCMake/Syntax/BracketNoSpace3.cmake new file mode 100644 index 0000000..45dc900 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace3.cmake @@ -0,0 +1 @@ +message(STATUS "string" #[[bracket comment]][[bracket]]) diff --git a/Tests/RunCMake/Syntax/BracketNoSpace4-result.txt b/Tests/RunCMake/Syntax/BracketNoSpace4-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace4-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/BracketNoSpace4-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace4-stderr.txt new file mode 100644 index 0000000..a461e93 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace4-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at CMakeLists.txt:3 \(include\): + Syntax Error in cmake code at + + .*/Tests/RunCMake/Syntax/BracketNoSpace4.cmake:1:44 + + Argument not separated from preceding token by whitespace. diff --git a/Tests/RunCMake/Syntax/BracketNoSpace4.cmake b/Tests/RunCMake/Syntax/BracketNoSpace4.cmake new file mode 100644 index 0000000..cb4ddbe --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace4.cmake @@ -0,0 +1 @@ +message(STATUS "string"#[[bracket comment]]"string") diff --git a/Tests/RunCMake/Syntax/BracketNoSpace5-result.txt b/Tests/RunCMake/Syntax/BracketNoSpace5-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace5-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/BracketNoSpace5-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace5-stderr.txt new file mode 100644 index 0000000..ff8bf1c --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace5-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at CMakeLists.txt:3 \(include\): + Syntax Error in cmake code at + + .*/Tests/RunCMake/Syntax/BracketNoSpace5.cmake:1:45 + + Argument not separated from preceding token by whitespace. diff --git a/Tests/RunCMake/Syntax/BracketNoSpace5.cmake b/Tests/RunCMake/Syntax/BracketNoSpace5.cmake new file mode 100644 index 0000000..c684523 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace5.cmake @@ -0,0 +1 @@ +message(STATUS "string" #[[bracket comment]]"string") diff --git a/Tests/RunCMake/Syntax/BracketWarn-stderr.txt b/Tests/RunCMake/Syntax/BracketWarn-stderr.txt deleted file mode 100644 index 4a9cca6..0000000 --- a/Tests/RunCMake/Syntax/BracketWarn-stderr.txt +++ /dev/null @@ -1,35 +0,0 @@ -CMake Warning \(dev\) at CMakeLists.txt:3 \(include\): - Syntax Warning in cmake code at - - .*/Tests/RunCMake/Syntax/BracketWarn.cmake:1:16 - - A future version of CMake may treat unquoted argument: - - \[\[ - - as an opening long bracket. Double-quote the argument. -This warning is for project developers. Use -Wno-dev to suppress it. - -CMake Warning \(dev\) at CMakeLists.txt:3 \(include\): - Syntax Warning in cmake code at - - .*/Tests/RunCMake/Syntax/BracketWarn.cmake:1:19 - - A future version of CMake may treat unquoted argument: - - \[=\[ - - as an opening long bracket. Double-quote the argument. -This warning is for project developers. Use -Wno-dev to suppress it. - -CMake Warning \(dev\) at CMakeLists.txt:3 \(include\): - Syntax Warning in cmake code at - - .*/Tests/RunCMake/Syntax/BracketWarn.cmake:1:27 - - A future version of CMake may treat unquoted argument: - - \[==\[x - - as an opening long bracket. Double-quote the argument. -This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/Syntax/BracketWarn-stdout.txt b/Tests/RunCMake/Syntax/BracketWarn-stdout.txt deleted file mode 100644 index 01b2caa..0000000 --- a/Tests/RunCMake/Syntax/BracketWarn-stdout.txt +++ /dev/null @@ -1 +0,0 @@ --- \[\[\[=\[\[=x\[==\[x diff --git a/Tests/RunCMake/Syntax/BracketWarn.cmake b/Tests/RunCMake/Syntax/BracketWarn.cmake deleted file mode 100644 index 8f33946..0000000 --- a/Tests/RunCMake/Syntax/BracketWarn.cmake +++ /dev/null @@ -1 +0,0 @@ -message(STATUS [[ [=[ [=x [==[x) diff --git a/Tests/RunCMake/Syntax/CommandError2-result.txt b/Tests/RunCMake/Syntax/CommandError2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/CommandError2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/CommandError2-stderr.txt b/Tests/RunCMake/Syntax/CommandError2-stderr.txt new file mode 100644 index 0000000..f4dfc77 --- /dev/null +++ b/Tests/RunCMake/Syntax/CommandError2-stderr.txt @@ -0,0 +1,7 @@ +CMake Error: Error in cmake code at +.*/Tests/RunCMake/Syntax/CommandError2.cmake:1: +Parse error. Expected a command name, got bracket argument with text "oops-not-a-comment". +CMake Error at CMakeLists.txt:3 \(include\): + include could not find load file: + + CommandError2.cmake diff --git a/Tests/RunCMake/Syntax/CommandError2.cmake b/Tests/RunCMake/Syntax/CommandError2.cmake new file mode 100644 index 0000000..a269682 --- /dev/null +++ b/Tests/RunCMake/Syntax/CommandError2.cmake @@ -0,0 +1 @@ +message("Example Message") [[oops-not-a-comment]] diff --git a/Tests/RunCMake/Syntax/Escape1-stderr.txt b/Tests/RunCMake/Syntax/Escape1-stderr.txt new file mode 100644 index 0000000..6601ce7 --- /dev/null +++ b/Tests/RunCMake/Syntax/Escape1-stderr.txt @@ -0,0 +1,3 @@ +^\\##\[\[#\]\]#\[\[\]\]x#\\" +\$\@\^\\; \(\)#\\" +\$\@\^; \(\)$ diff --git a/Tests/RunCMake/Syntax/Escape1.cmake b/Tests/RunCMake/Syntax/Escape1.cmake new file mode 100644 index 0000000..3bf801e --- /dev/null +++ b/Tests/RunCMake/Syntax/Escape1.cmake @@ -0,0 +1,3 @@ +message([[\#]] \#[[ \#]] "#[[]]" x#comment + "\#\\\"\n\$\@\^\;\ \t\(\)"#comment + \#\\\"\n\$\@\^\;\ \t\(\)) diff --git a/Tests/RunCMake/Syntax/ForEachBracket1-stderr.txt b/Tests/RunCMake/Syntax/ForEachBracket1-stderr.txt new file mode 100644 index 0000000..93c31cf --- /dev/null +++ b/Tests/RunCMake/Syntax/ForEachBracket1-stderr.txt @@ -0,0 +1,2 @@ +^\${x}:a +\${x}:b$ diff --git a/Tests/RunCMake/Syntax/ForEachBracket1.cmake b/Tests/RunCMake/Syntax/ForEachBracket1.cmake new file mode 100644 index 0000000..a55e21f --- /dev/null +++ b/Tests/RunCMake/Syntax/ForEachBracket1.cmake @@ -0,0 +1,3 @@ +foreach(x a b) + message([[${x}:]] "${x}") +endforeach() diff --git a/Tests/RunCMake/Syntax/FunctionBracket1-stderr.txt b/Tests/RunCMake/Syntax/FunctionBracket1-stderr.txt new file mode 100644 index 0000000..9ba6179 --- /dev/null +++ b/Tests/RunCMake/Syntax/FunctionBracket1-stderr.txt @@ -0,0 +1,2 @@ +^\${x},\${ARGN},\${ARGC},\${ARGV},\${ARGV0},\${ARGV1},\${ARGV2}:a,n,2,a;n,a,n, +\${x},\${ARGN},\${ARGC},\${ARGV},\${ARGV0},\${ARGV1},\${ARGV2}:b,n,2,b;n,b,n,$ diff --git a/Tests/RunCMake/Syntax/FunctionBracket1.cmake b/Tests/RunCMake/Syntax/FunctionBracket1.cmake new file mode 100644 index 0000000..8ed4f65 --- /dev/null +++ b/Tests/RunCMake/Syntax/FunctionBracket1.cmake @@ -0,0 +1,6 @@ +function(fun x) + message([[${x},${ARGN},${ARGC},${ARGV},${ARGV0},${ARGV1},${ARGV2}:]] + "${x},${ARGN},${ARGC},${ARGV},${ARGV0},${ARGV1},${ARGV2}") +endfunction(fun) +fun(a n) +fun(b n) diff --git a/Tests/RunCMake/Syntax/MacroBracket1-stderr.txt b/Tests/RunCMake/Syntax/MacroBracket1-stderr.txt new file mode 100644 index 0000000..9ba6179 --- /dev/null +++ b/Tests/RunCMake/Syntax/MacroBracket1-stderr.txt @@ -0,0 +1,2 @@ +^\${x},\${ARGN},\${ARGC},\${ARGV},\${ARGV0},\${ARGV1},\${ARGV2}:a,n,2,a;n,a,n, +\${x},\${ARGN},\${ARGC},\${ARGV},\${ARGV0},\${ARGV1},\${ARGV2}:b,n,2,b;n,b,n,$ diff --git a/Tests/RunCMake/Syntax/MacroBracket1.cmake b/Tests/RunCMake/Syntax/MacroBracket1.cmake new file mode 100644 index 0000000..ef6de20 --- /dev/null +++ b/Tests/RunCMake/Syntax/MacroBracket1.cmake @@ -0,0 +1,6 @@ +macro(mac x) + message([[${x},${ARGN},${ARGC},${ARGV},${ARGV0},${ARGV1},${ARGV2}:]] + "${x},${ARGN},${ARGC},${ARGV},${ARGV0},${ARGV1},${ARGV2}") +endmacro(mac) +mac(a n) +mac(b n) diff --git a/Tests/RunCMake/Syntax/OneLetter-stderr.txt b/Tests/RunCMake/Syntax/OneLetter-stderr.txt new file mode 100644 index 0000000..87c01c7 --- /dev/null +++ b/Tests/RunCMake/Syntax/OneLetter-stderr.txt @@ -0,0 +1 @@ +message diff --git a/Tests/RunCMake/Syntax/OneLetter.cmake b/Tests/RunCMake/Syntax/OneLetter.cmake new file mode 100644 index 0000000..3c341fa --- /dev/null +++ b/Tests/RunCMake/Syntax/OneLetter.cmake @@ -0,0 +1,7 @@ +function(f) + g(${ARGN}) +endfunction() +macro(g) + message(${ARGN}) +endmacro() +f(message) diff --git a/Tests/RunCMake/Syntax/ParenNoSpace0-stdout.txt b/Tests/RunCMake/Syntax/ParenNoSpace0-stdout.txt new file mode 100644 index 0000000..5c4076f --- /dev/null +++ b/Tests/RunCMake/Syntax/ParenNoSpace0-stdout.txt @@ -0,0 +1,3 @@ +-- \(unquoted\) +-- \(quoted\) +-- \(bracket\) diff --git a/Tests/RunCMake/Syntax/ParenNoSpace0.cmake b/Tests/RunCMake/Syntax/ParenNoSpace0.cmake new file mode 100644 index 0000000..175fe4a --- /dev/null +++ b/Tests/RunCMake/Syntax/ParenNoSpace0.cmake @@ -0,0 +1,3 @@ +message(STATUS (unquoted)) +message(STATUS ("quoted")) +message(STATUS ([[bracket]])) diff --git a/Tests/RunCMake/Syntax/ParenNoSpace1-result.txt b/Tests/RunCMake/Syntax/ParenNoSpace1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/ParenNoSpace1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/ParenNoSpace1-stderr.txt b/Tests/RunCMake/Syntax/ParenNoSpace1-stderr.txt new file mode 100644 index 0000000..64ef8b1 --- /dev/null +++ b/Tests/RunCMake/Syntax/ParenNoSpace1-stderr.txt @@ -0,0 +1,22 @@ +CMake Warning \(dev\) at CMakeLists.txt:3 \(include\): + Syntax Warning in cmake code at + + .*/Tests/RunCMake/Syntax/ParenNoSpace1.cmake:1:26 + + Argument not separated from preceding token by whitespace. +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\) at CMakeLists.txt:3 \(include\): + Syntax Warning in cmake code at + + .*/Tests/RunCMake/Syntax/ParenNoSpace1.cmake:2:26 + + Argument not separated from preceding token by whitespace. +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Error at CMakeLists.txt:3 \(include\): + Syntax Error in cmake code at + + .*/Tests/RunCMake/Syntax/ParenNoSpace1.cmake:3:29 + + Argument not separated from preceding token by whitespace. diff --git a/Tests/RunCMake/Syntax/ParenNoSpace1.cmake b/Tests/RunCMake/Syntax/ParenNoSpace1.cmake new file mode 100644 index 0000000..550339a --- /dev/null +++ b/Tests/RunCMake/Syntax/ParenNoSpace1.cmake @@ -0,0 +1,3 @@ +message(STATUS (unquoted)unquoted) +message(STATUS ("quoted")"quoted") +message(STATUS ([[bracket]])[[bracket]]) diff --git a/Tests/RunCMake/Syntax/ParenNoSpace2-stderr.txt b/Tests/RunCMake/Syntax/ParenNoSpace2-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/Syntax/ParenNoSpace2-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/Syntax/ParenNoSpace-stdout.txt b/Tests/RunCMake/Syntax/ParenNoSpace2-stdout.txt index 72addd7..0e657b9 100644 --- a/Tests/RunCMake/Syntax/ParenNoSpace-stdout.txt +++ b/Tests/RunCMake/Syntax/ParenNoSpace2-stdout.txt @@ -1,2 +1,3 @@ -- unquoted\(unquoted\) -- quoted\(quoted\) +-- bracket\(bracket\) diff --git a/Tests/RunCMake/Syntax/ParenNoSpace.cmake b/Tests/RunCMake/Syntax/ParenNoSpace2.cmake index c690d96..c46a887 100644 --- a/Tests/RunCMake/Syntax/ParenNoSpace.cmake +++ b/Tests/RunCMake/Syntax/ParenNoSpace2.cmake @@ -1,2 +1,3 @@ message(STATUS unquoted(unquoted)) message(STATUS "quoted"("quoted")) +message(STATUS [[bracket]]([[bracket]])) diff --git a/Tests/RunCMake/Syntax/RunCMakeTest.cmake b/Tests/RunCMake/Syntax/RunCMakeTest.cmake index 94963f3..5f05cfc 100644 --- a/Tests/RunCMake/Syntax/RunCMakeTest.cmake +++ b/Tests/RunCMake/Syntax/RunCMakeTest.cmake @@ -1,18 +1,54 @@ include(RunCMake) +run_cmake(BOM-UTF-8) +run_cmake(BOM-UTF-16-LE) +run_cmake(BOM-UTF-16-BE) +run_cmake(BOM-UTF-32-LE) +run_cmake(BOM-UTF-32-BE) run_cmake(CommandSpaces) run_cmake(CommandTabs) run_cmake(CommandNewlines) run_cmake(CommandComments) run_cmake(CommandError0) run_cmake(CommandError1) +run_cmake(CommandError2) +run_cmake(ForEachBracket1) +run_cmake(FunctionBracket1) +run_cmake(MacroBracket1) run_cmake(String0) run_cmake(String1) +run_cmake(StringBackslash) +run_cmake(StringCRLF) +run_cmake(StringContinuation1) +run_cmake(StringContinuation2) run_cmake(StringNoSpace) +run_cmake(OneLetter) run_cmake(Unquoted0) run_cmake(Unquoted1) -run_cmake(ParenNoSpace) +run_cmake(Bracket0) +run_cmake(Bracket1) +run_cmake(Bracket2) +run_cmake(BracketBackslash) +run_cmake(BracketCRLF) +run_cmake(BracketComment0) +run_cmake(BracketComment1) +run_cmake(BracketComment2) +run_cmake(BracketComment3) +run_cmake(BracketComment4) +run_cmake(BracketComment5) +run_cmake(BracketNoSpace0) +run_cmake(BracketNoSpace1) +run_cmake(BracketNoSpace2) +run_cmake(BracketNoSpace3) +run_cmake(BracketNoSpace4) +run_cmake(BracketNoSpace5) +run_cmake(Escape1) +run_cmake(ParenNoSpace0) +run_cmake(ParenNoSpace1) +run_cmake(ParenNoSpace2) run_cmake(UnterminatedCall1) run_cmake(UnterminatedCall2) run_cmake(UnterminatedString) -run_cmake(BracketWarn) +run_cmake(UnterminatedBracket0) +run_cmake(UnterminatedBracket1) +run_cmake(UnterminatedBracketComment) diff --git a/Tests/RunCMake/Syntax/StringBackslash-result.txt b/Tests/RunCMake/Syntax/StringBackslash-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/StringBackslash-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/StringBackslash-stderr.txt b/Tests/RunCMake/Syntax/StringBackslash-stderr.txt new file mode 100644 index 0000000..214f914 --- /dev/null +++ b/Tests/RunCMake/Syntax/StringBackslash-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at StringBackslash.cmake:1 \(message\): + a\\ + + b +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/StringBackslash.cmake b/Tests/RunCMake/Syntax/StringBackslash.cmake new file mode 100644 index 0000000..066be96 --- /dev/null +++ b/Tests/RunCMake/Syntax/StringBackslash.cmake @@ -0,0 +1,2 @@ +message(FATAL_ERROR "a\\ +b") diff --git a/Tests/RunCMake/Syntax/StringCRLF-stderr.txt b/Tests/RunCMake/Syntax/StringCRLF-stderr.txt new file mode 100644 index 0000000..7aef26e --- /dev/null +++ b/Tests/RunCMake/Syntax/StringCRLF-stderr.txt @@ -0,0 +1 @@ +CRLF->LF worked diff --git a/Tests/RunCMake/Syntax/StringCRLF.cmake b/Tests/RunCMake/Syntax/StringCRLF.cmake new file mode 100644 index 0000000..d20cfea --- /dev/null +++ b/Tests/RunCMake/Syntax/StringCRLF.cmake @@ -0,0 +1,6 @@ +if("a
+b" STREQUAL "a\nb")
+ message("CRLF->LF worked")
+else()
+ message(FATAL_ERROR "CRLF->LF failed")
+endif()
diff --git a/Tests/RunCMake/Syntax/StringContinuation1-result.txt b/Tests/RunCMake/Syntax/StringContinuation1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/StringContinuation1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/StringContinuation1-stderr.txt b/Tests/RunCMake/Syntax/StringContinuation1-stderr.txt new file mode 100644 index 0000000..05771da --- /dev/null +++ b/Tests/RunCMake/Syntax/StringContinuation1-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at StringContinuation1.cmake:1 \(message\): + ab +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/StringContinuation1.cmake b/Tests/RunCMake/Syntax/StringContinuation1.cmake new file mode 100644 index 0000000..ae86bb2 --- /dev/null +++ b/Tests/RunCMake/Syntax/StringContinuation1.cmake @@ -0,0 +1,2 @@ +message(FATAL_ERROR "a\ +b") diff --git a/Tests/RunCMake/Syntax/StringContinuation2-result.txt b/Tests/RunCMake/Syntax/StringContinuation2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/StringContinuation2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/StringContinuation2-stderr.txt b/Tests/RunCMake/Syntax/StringContinuation2-stderr.txt new file mode 100644 index 0000000..2f4964c --- /dev/null +++ b/Tests/RunCMake/Syntax/StringContinuation2-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at StringContinuation2.cmake:1 \(message\): + a\\b +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/StringContinuation2.cmake b/Tests/RunCMake/Syntax/StringContinuation2.cmake new file mode 100644 index 0000000..490a408 --- /dev/null +++ b/Tests/RunCMake/Syntax/StringContinuation2.cmake @@ -0,0 +1,2 @@ +message(FATAL_ERROR "a\\\ +b") diff --git a/Tests/RunCMake/Syntax/UnterminatedBracket0-result.txt b/Tests/RunCMake/Syntax/UnterminatedBracket0-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBracket0-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/UnterminatedBracket0-stderr.txt b/Tests/RunCMake/Syntax/UnterminatedBracket0-stderr.txt new file mode 100644 index 0000000..3559c18 --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBracket0-stderr.txt @@ -0,0 +1,8 @@ +CMake Error: Error in cmake code at +.*/Syntax/UnterminatedBracket0.cmake:2: +Parse error. Function missing ending "\)". Instead found unterminated bracket with text "\) +". +CMake Error at CMakeLists.txt:3 \(include\): + include could not find load file: + + UnterminatedBracket0.cmake$ diff --git a/Tests/RunCMake/Syntax/UnterminatedBracket0.cmake b/Tests/RunCMake/Syntax/UnterminatedBracket0.cmake new file mode 100644 index 0000000..98cd906 --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBracket0.cmake @@ -0,0 +1 @@ +set(var [[) diff --git a/Tests/RunCMake/Syntax/UnterminatedBracket1-result.txt b/Tests/RunCMake/Syntax/UnterminatedBracket1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBracket1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/UnterminatedBracket1-stderr.txt b/Tests/RunCMake/Syntax/UnterminatedBracket1-stderr.txt new file mode 100644 index 0000000..55d458b --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBracket1-stderr.txt @@ -0,0 +1,8 @@ +CMake Error: Error in cmake code at +.*/Syntax/UnterminatedBracket1.cmake:2: +Parse error. Function missing ending "\)". Instead found unterminated bracket with text "\]\]\) +". +CMake Error at CMakeLists.txt:3 \(include\): + include could not find load file: + + UnterminatedBracket1.cmake$ diff --git a/Tests/RunCMake/Syntax/UnterminatedBracket1.cmake b/Tests/RunCMake/Syntax/UnterminatedBracket1.cmake new file mode 100644 index 0000000..706f7a3 --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBracket1.cmake @@ -0,0 +1 @@ +set(var [=[]]) diff --git a/Tests/RunCMake/Syntax/UnterminatedBracketComment-result.txt b/Tests/RunCMake/Syntax/UnterminatedBracketComment-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBracketComment-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/UnterminatedBracketComment-stderr.txt b/Tests/RunCMake/Syntax/UnterminatedBracketComment-stderr.txt new file mode 100644 index 0000000..0a799eb --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBracketComment-stderr.txt @@ -0,0 +1,8 @@ +CMake Error: Error in cmake code at +.*/Syntax/UnterminatedBracketComment.cmake:1: +Parse error. Expected a command name, got unterminated bracket with text "#\]\] +". +CMake Error at CMakeLists.txt:3 \(include\): + include could not find load file: + + UnterminatedBracketComment.cmake diff --git a/Tests/RunCMake/Syntax/UnterminatedBracketComment.cmake b/Tests/RunCMake/Syntax/UnterminatedBracketComment.cmake new file mode 100644 index 0000000..ad71f3c --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBracketComment.cmake @@ -0,0 +1,2 @@ +#[=[ +#]] diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt index 6533b75..5a80872 100644 --- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt +++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt @@ -11,3 +11,8 @@ \* CMP0020 \* CMP0021 \* CMP0022 + \* CMP0041 + \* CMP0042 + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/build_command/BeforeProject-stderr.txt b/Tests/RunCMake/build_command/BeforeProject-stderr.txt index d3d7661..2ae0ed1 100644 --- a/Tests/RunCMake/build_command/BeforeProject-stderr.txt +++ b/Tests/RunCMake/build_command/BeforeProject-stderr.txt @@ -1,5 +1,7 @@ -CMake Error at BeforeProject.cmake:[0-9]+ \(build_command\): - build_command\(\) requires CMAKE_MAKE_PROGRAM to be defined. Call project\(\) - or enable_language\(\) first. +CMake Warning \(dev\) at BeforeProject.cmake:2 \(message\): + build_command\(\) returned: + + .*cmake.* --build \..* Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\) + CMakeLists.txt:5 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/build_command/BeforeProject.cmake b/Tests/RunCMake/build_command/BeforeProject.cmake index 15788d1..a2175c4 100644 --- a/Tests/RunCMake/build_command/BeforeProject.cmake +++ b/Tests/RunCMake/build_command/BeforeProject.cmake @@ -1,2 +1,3 @@ build_command(MAKECOMMAND_DEFAULT_VALUE) +message(AUTHOR_WARNING "build_command() returned:\n ${MAKECOMMAND_DEFAULT_VALUE}") project(${RunCMake_TEST} NONE) diff --git a/Tests/RunCMake/build_command/ErrorsCommon.cmake b/Tests/RunCMake/build_command/ErrorsCommon.cmake index d224539..f007b88 100644 --- a/Tests/RunCMake/build_command/ErrorsCommon.cmake +++ b/Tests/RunCMake/build_command/ErrorsCommon.cmake @@ -37,9 +37,9 @@ build_command(cmd) message("4. cmd='${cmd}'") # Test the two-arg legacy signature: -build_command(legacy_cmd ${CMAKE_BUILD_TOOL}) +build_command(legacy_cmd ${CMAKE_MAKE_PROGRAM}) message("5. legacy_cmd='${legacy_cmd}'") -message(" CMAKE_BUILD_TOOL='${CMAKE_BUILD_TOOL}'") +message(" CMAKE_MAKE_PROGRAM='${CMAKE_MAKE_PROGRAM}'") # Test the optional KEYWORDs: build_command(cmd CONFIGURATION hoohaaConfig) diff --git a/Tests/RunCMake/cmake_minimum_required/Before24-stderr.txt b/Tests/RunCMake/cmake_minimum_required/Before24-stderr.txt new file mode 100644 index 0000000..4a6f16d --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/Before24-stderr.txt @@ -0,0 +1,5 @@ +CMake Warning \(dev\) at Before24.cmake:1 \(cmake_minimum_required\): + Compatibility with CMake < 2.4 is not supported by CMake >= 3.0. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/cmake_minimum_required/Before24.cmake b/Tests/RunCMake/cmake_minimum_required/Before24.cmake new file mode 100644 index 0000000..c28fc8a --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/Before24.cmake @@ -0,0 +1 @@ +cmake_minimum_required(VERSION 2.2) diff --git a/Tests/RunCMake/cmake_minimum_required/CMakeLists.txt b/Tests/RunCMake/cmake_minimum_required/CMakeLists.txt new file mode 100644 index 0000000..e8db6b0 --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/cmake_minimum_required/CompatBefore24-result.txt b/Tests/RunCMake/cmake_minimum_required/CompatBefore24-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/CompatBefore24-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_minimum_required/CompatBefore24-stderr.txt b/Tests/RunCMake/cmake_minimum_required/CompatBefore24-stderr.txt new file mode 100644 index 0000000..a874466 --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/CompatBefore24-stderr.txt @@ -0,0 +1,5 @@ +CMake Error in CMakeLists.txt: + You have set CMAKE_BACKWARDS_COMPATIBILITY to a CMake version less than + 2.4. This version of CMake only supports backwards compatibility with + CMake 2.4 or later. For compatibility with older versions please use any + CMake 2.8.x release or lower. diff --git a/Tests/RunCMake/cmake_minimum_required/CompatBefore24.cmake b/Tests/RunCMake/cmake_minimum_required/CompatBefore24.cmake new file mode 100644 index 0000000..ca0cb1d --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/CompatBefore24.cmake @@ -0,0 +1,2 @@ +cmake_minimum_required(VERSION 2.4) +set(CMAKE_BACKWARDS_COMPATIBILITY 2.2) diff --git a/Tests/RunCMake/cmake_minimum_required/PolicyBefore24-result.txt b/Tests/RunCMake/cmake_minimum_required/PolicyBefore24-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/PolicyBefore24-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_minimum_required/PolicyBefore24-stderr.txt b/Tests/RunCMake/cmake_minimum_required/PolicyBefore24-stderr.txt new file mode 100644 index 0000000..840211a --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/PolicyBefore24-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at PolicyBefore24.cmake:2 \(cmake_policy\): + Compatibility with CMake < 2.4 is not supported by CMake >= 3.0. For + compatibility with older versions please use any CMake 2.8.x release or + lower. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/cmake_minimum_required/PolicyBefore24.cmake b/Tests/RunCMake/cmake_minimum_required/PolicyBefore24.cmake new file mode 100644 index 0000000..62d3836 --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/PolicyBefore24.cmake @@ -0,0 +1,2 @@ +cmake_minimum_required(VERSION 2.4) +cmake_policy(VERSION 2.2) diff --git a/Tests/RunCMake/cmake_minimum_required/RunCMakeTest.cmake b/Tests/RunCMake/cmake_minimum_required/RunCMakeTest.cmake new file mode 100644 index 0000000..e4c65e3 --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(Before24) +run_cmake(CompatBefore24) +run_cmake(PolicyBefore24) diff --git a/Tests/RunCMake/export/AppendExport-result.txt b/Tests/RunCMake/export/AppendExport-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/export/AppendExport-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/export/AppendExport-stderr.txt b/Tests/RunCMake/export/AppendExport-stderr.txt new file mode 100644 index 0000000..6e385d4 --- /dev/null +++ b/Tests/RunCMake/export/AppendExport-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at AppendExport.cmake:8 \(export\): + export EXPORT signature does not recognise the APPEND option. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/export/AppendExport.cmake b/Tests/RunCMake/export/AppendExport.cmake new file mode 100644 index 0000000..f36010b --- /dev/null +++ b/Tests/RunCMake/export/AppendExport.cmake @@ -0,0 +1,8 @@ +add_library(foo empty.cpp) +export(TARGETS foo FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake") +install(TARGETS foo EXPORT fooExport + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) +export(EXPORT fooExport APPEND FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake") diff --git a/Tests/RunCMake/export/CMakeLists.txt b/Tests/RunCMake/export/CMakeLists.txt new file mode 100644 index 0000000..be9d403 --- /dev/null +++ b/Tests/RunCMake/export/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.4) +project(${RunCMake_TEST}) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/export/NoExportSet-result.txt b/Tests/RunCMake/export/NoExportSet-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/export/NoExportSet-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/export/NoExportSet-stderr.txt b/Tests/RunCMake/export/NoExportSet-stderr.txt new file mode 100644 index 0000000..9d27805 --- /dev/null +++ b/Tests/RunCMake/export/NoExportSet-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at NoExportSet.cmake:2 \(export\): + export Export set "fooExport" not found. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/export/NoExportSet.cmake b/Tests/RunCMake/export/NoExportSet.cmake new file mode 100644 index 0000000..72390e8 --- /dev/null +++ b/Tests/RunCMake/export/NoExportSet.cmake @@ -0,0 +1,2 @@ + +export(EXPORT fooExport) diff --git a/Tests/RunCMake/export/OldIface-result.txt b/Tests/RunCMake/export/OldIface-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/export/OldIface-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/export/OldIface-stderr.txt b/Tests/RunCMake/export/OldIface-stderr.txt new file mode 100644 index 0000000..afb4ae3 --- /dev/null +++ b/Tests/RunCMake/export/OldIface-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at OldIface.cmake:8 \(export\): + export EXPORT signature does not recognise the + EXPORT_LINK_INTERFACE_LIBRARIES option. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/export/OldIface.cmake b/Tests/RunCMake/export/OldIface.cmake new file mode 100644 index 0000000..5fb8e25 --- /dev/null +++ b/Tests/RunCMake/export/OldIface.cmake @@ -0,0 +1,10 @@ +add_library(foo empty.cpp) +export(TARGETS foo FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake") +install(TARGETS foo EXPORT fooExport + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) +export(EXPORT fooExport + EXPORT_LINK_INTERFACE_LIBRARIES +) diff --git a/Tests/RunCMake/export/RunCMakeTest.cmake b/Tests/RunCMake/export/RunCMakeTest.cmake new file mode 100644 index 0000000..4b04f18 --- /dev/null +++ b/Tests/RunCMake/export/RunCMakeTest.cmake @@ -0,0 +1,6 @@ +include(RunCMake) + +run_cmake(TargetNotFound) +run_cmake(AppendExport) +run_cmake(OldIface) +run_cmake(NoExportSet) diff --git a/Tests/RunCMake/export/TargetNotFound-result.txt b/Tests/RunCMake/export/TargetNotFound-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/export/TargetNotFound-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/export/TargetNotFound-stderr.txt b/Tests/RunCMake/export/TargetNotFound-stderr.txt new file mode 100644 index 0000000..944a68e --- /dev/null +++ b/Tests/RunCMake/export/TargetNotFound-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at TargetNotFound.cmake:1 \(export\): + export given target "nonexistenttarget" which is not built by this project. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/export/TargetNotFound.cmake b/Tests/RunCMake/export/TargetNotFound.cmake new file mode 100644 index 0000000..a7c398d --- /dev/null +++ b/Tests/RunCMake/export/TargetNotFound.cmake @@ -0,0 +1 @@ +export(TARGETS nonexistenttarget FILE somefile.cmake) diff --git a/Tests/RunCMake/include/CMP0024-NEW-result.txt b/Tests/RunCMake/include/CMP0024-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/include/CMP0024-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/include/CMP0024-NEW-stderr.txt b/Tests/RunCMake/include/CMP0024-NEW-stderr.txt new file mode 100644 index 0000000..059d7e4 --- /dev/null +++ b/Tests/RunCMake/include/CMP0024-NEW-stderr.txt @@ -0,0 +1,12 @@ +CMake Error at subdir2/CMakeLists.txt:2 \(include\): + Policy CMP0024 is not set: Disallow include export result. Run "cmake + --help-policy CMP0024" for policy details. Use the cmake_policy command to + set the policy and suppress this warning. + + The file + + .*/Tests/RunCMake/include/CMP0024-NEW-build/subdir1/theTargets.cmake + + was generated by the export\(\) command. It may not be used as the argument + to the include\(\) command. Use ALIAS targets instead to refer to targets by + alternative names. diff --git a/Tests/RunCMake/include/CMP0024-NEW.cmake b/Tests/RunCMake/include/CMP0024-NEW.cmake new file mode 100644 index 0000000..0e03d2a --- /dev/null +++ b/Tests/RunCMake/include/CMP0024-NEW.cmake @@ -0,0 +1,9 @@ + +enable_language(CXX) + +cmake_policy(SET CMP0024 NEW) + +add_library(foo SHARED empty.cpp) + +add_subdirectory(subdir1) +add_subdirectory(subdir2) diff --git a/Tests/RunCMake/include/CMP0024-WARN-result.txt b/Tests/RunCMake/include/CMP0024-WARN-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/include/CMP0024-WARN-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/include/CMP0024-WARN-stderr.txt b/Tests/RunCMake/include/CMP0024-WARN-stderr.txt new file mode 100644 index 0000000..9c79007 --- /dev/null +++ b/Tests/RunCMake/include/CMP0024-WARN-stderr.txt @@ -0,0 +1,14 @@ +CMake Warning \(dev\) at subdir2/CMakeLists.txt:2 \(include\): + Policy CMP0024 is not set: Disallow include export result. Run "cmake + --help-policy CMP0024" for policy details. Use the cmake_policy command to + set the policy and suppress this warning. + + The file + + .*/Tests/RunCMake/include/CMP0024-WARN-build/subdir1/theTargets.cmake + + was generated by the export\(\) command. It should not be used as the + argument to the include\(\) command. Use ALIAS targets instead to refer to + targets by alternative names. + +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/include/CMP0024-WARN.cmake b/Tests/RunCMake/include/CMP0024-WARN.cmake new file mode 100644 index 0000000..783cf78 --- /dev/null +++ b/Tests/RunCMake/include/CMP0024-WARN.cmake @@ -0,0 +1,7 @@ + +enable_language(CXX) + +add_library(foo SHARED empty.cpp) + +add_subdirectory(subdir1) +add_subdirectory(subdir2) diff --git a/Tests/RunCMake/include/ExportExportInclude-result.txt b/Tests/RunCMake/include/ExportExportInclude-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/include/ExportExportInclude-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/include/ExportExportInclude-stderr.txt b/Tests/RunCMake/include/ExportExportInclude-stderr.txt new file mode 100644 index 0000000..70d013c --- /dev/null +++ b/Tests/RunCMake/include/ExportExportInclude-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at ExportExportInclude.cmake:6 \(include\): + include could not find load file: + + .*/Tests/RunCMake/include/ExportExportInclude-build/theTargets.cmake +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/include/ExportExportInclude.cmake b/Tests/RunCMake/include/ExportExportInclude.cmake new file mode 100644 index 0000000..14e5d91 --- /dev/null +++ b/Tests/RunCMake/include/ExportExportInclude.cmake @@ -0,0 +1,6 @@ + +add_library(iface INTERFACE) +install(TARGETS iface EXPORT ifaceExport) + +export(EXPORT ifaceExport FILE "${CMAKE_CURRENT_BINARY_DIR}/theTargets.cmake") +include("${CMAKE_CURRENT_BINARY_DIR}/theTargets.cmake") diff --git a/Tests/RunCMake/include/RunCMakeTest.cmake b/Tests/RunCMake/include/RunCMakeTest.cmake index 59b87ca..bea7d5c 100644 --- a/Tests/RunCMake/include/RunCMakeTest.cmake +++ b/Tests/RunCMake/include/RunCMakeTest.cmake @@ -2,3 +2,6 @@ include(RunCMake) run_cmake(EmptyString) run_cmake(EmptyStringOptional) +run_cmake(CMP0024-WARN) +run_cmake(CMP0024-NEW) +run_cmake(ExportExportInclude) diff --git a/Tests/RunCMake/include/empty.cpp b/Tests/RunCMake/include/empty.cpp new file mode 100644 index 0000000..bfbbdde --- /dev/null +++ b/Tests/RunCMake/include/empty.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/include/subdir1/CMakeLists.txt b/Tests/RunCMake/include/subdir1/CMakeLists.txt new file mode 100644 index 0000000..11a76d1 --- /dev/null +++ b/Tests/RunCMake/include/subdir1/CMakeLists.txt @@ -0,0 +1,2 @@ + +export(TARGETS foo FILE "${CMAKE_CURRENT_BINARY_DIR}/theTargets.cmake") diff --git a/Tests/RunCMake/include/subdir2/CMakeLists.txt b/Tests/RunCMake/include/subdir2/CMakeLists.txt new file mode 100644 index 0000000..7361f9c --- /dev/null +++ b/Tests/RunCMake/include/subdir2/CMakeLists.txt @@ -0,0 +1,2 @@ + +include("${CMAKE_CURRENT_BINARY_DIR}/../subdir1/theTargets.cmake") diff --git a/Tests/RunCMake/include_directories/CMakeLists.txt b/Tests/RunCMake/include_directories/CMakeLists.txt index 12cd3c7..f452db1 100644 --- a/Tests/RunCMake/include_directories/CMakeLists.txt +++ b/Tests/RunCMake/include_directories/CMakeLists.txt @@ -1,3 +1,3 @@ cmake_minimum_required(VERSION 2.8.4) -project(${RunCMake_TEST} NONE) +project(${RunCMake_TEST} CXX) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/include_directories/RunCMakeTest.cmake b/Tests/RunCMake/include_directories/RunCMakeTest.cmake index f0704f4..c00b924 100644 --- a/Tests/RunCMake/include_directories/RunCMakeTest.cmake +++ b/Tests/RunCMake/include_directories/RunCMakeTest.cmake @@ -10,3 +10,5 @@ run_cmake(ImportedTarget) run_cmake(RelativePathInGenex) run_cmake(CMP0021) run_cmake(install_config) +run_cmake(incomplete-genex) +run_cmake(export-NOWARN) diff --git a/Tests/RunCMake/include_directories/export-NOWARN-result.txt b/Tests/RunCMake/include_directories/export-NOWARN-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/include_directories/export-NOWARN-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/include_directories/export-NOWARN-stderr.txt b/Tests/RunCMake/include_directories/export-NOWARN-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/include_directories/export-NOWARN-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/include_directories/export-NOWARN.cmake b/Tests/RunCMake/include_directories/export-NOWARN.cmake new file mode 100644 index 0000000..307ce5a --- /dev/null +++ b/Tests/RunCMake/include_directories/export-NOWARN.cmake @@ -0,0 +1,62 @@ + +add_library(foo empty.cpp) +set_property(TARGET foo APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<0:>/include/subdir) +set_property(TARGET foo APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<INSTALL_PREFIX>/include/subdir) + +set_property(TARGET foo APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/subdir>) +set_property(TARGET foo APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<INSTALL_INTERFACE:include/subdir>) +set_property(TARGET foo APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<INSTALL_INTERFACE:include/$<0:>>) +set_property(TARGET foo APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<INSTALL_INTERFACE:$<0:>/include>) + +# target_include_directories(foo INTERFACE include/subdir) # Does and should warn. INSTALL_INTERFACE must not list src dir paths. +target_include_directories(foo INTERFACE $<0:>/include/subdir) # Does not and should not should warn, because it starts with a genex. +target_include_directories(foo INTERFACE $<INSTALL_PREFIX>/include/subdir) + +target_include_directories(foo INTERFACE $<INSTALL_INTERFACE:include/subdir>) +target_include_directories(foo INTERFACE $<INSTALL_INTERFACE:include/$<0:>>) + +install(TARGETS foo EXPORT FooTargets DESTINATION lib) +install(EXPORT FooTargets DESTINATION lib/cmake) + +install(TARGETS foo EXPORT FooTargets2 + DESTINATION lib + INCLUDES DESTINATION include # No warning. Implicit install prefix. +) +install(EXPORT FooTargets2 DESTINATION lib/cmake) + +install(TARGETS foo EXPORT FooTargets3 + DESTINATION lib + INCLUDES DESTINATION $<INSTALL_PREFIX>include +) +install(EXPORT FooTargets3 DESTINATION lib/cmake) + +install(TARGETS foo EXPORT FooTargets4 + DESTINATION lib + INCLUDES DESTINATION $<INSTALL_INTERFACE:include> +) +install(EXPORT FooTargets4 DESTINATION lib/cmake) + +install(TARGETS foo EXPORT FooTargets5 + DESTINATION lib + # The $<0:> is evaluated at export time, leaving 'include' behind, which should be treated as above. + INCLUDES DESTINATION $<INSTALL_INTERFACE:$<0:>include> +) +install(EXPORT FooTargets5 DESTINATION lib/cmake) + +install(TARGETS foo EXPORT FooTargets6 + DESTINATION lib + INCLUDES DESTINATION $<INSTALL_INTERFACE:include$<0:>> +) +install(EXPORT FooTargets6 DESTINATION lib/cmake) + +install(TARGETS foo EXPORT FooTargets7 + DESTINATION lib + INCLUDES DESTINATION include$<0:> +) +install(EXPORT FooTargets7 DESTINATION lib/cmake) + +install(TARGETS foo EXPORT FooTargets8 + DESTINATION lib + INCLUDES DESTINATION $<0:>include +) +install(EXPORT FooTargets8 DESTINATION lib/cmake) diff --git a/Tests/RunCMake/include_directories/incomplete-genex.cmake b/Tests/RunCMake/include_directories/incomplete-genex.cmake new file mode 100644 index 0000000..b6900a4 --- /dev/null +++ b/Tests/RunCMake/include_directories/incomplete-genex.cmake @@ -0,0 +1,23 @@ +project(incomplete-genex) + +cmake_policy(SET CMP0022 NEW) +cmake_policy(SET CMP0023 NEW) + +add_library(somelib empty.cpp) + +# This test ensures that some internal mechanisms of cmGeneratorExpression +# do not segfault (#14410). + +# Test that cmGeneratorExpression::Preprocess(StripAllGeneratorExpressions) +# does not segfault +target_include_directories(somelib PUBLIC + "/include;/include/$<BUILD_INTERFACE:subdir" +) + +# Test that cmGeneratorExpression::Preprocess(BuildInterface) does not segfault +export(TARGETS somelib FILE somelibTargets.cmake) + +install(TARGETS somelib EXPORT someExport DESTINATION prefix) +# Test that cmGeneratorExpression::Preprocess(InstallInterface) +# and cmGeneratorExpression::Split do not segfault +install(EXPORT someExport DESTINATION prefix) diff --git a/Tests/RunCMake/install/CMakeLists.txt b/Tests/RunCMake/install/CMakeLists.txt new file mode 100644 index 0000000..4b3de84 --- /dev/null +++ b/Tests/RunCMake/install/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.12) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake new file mode 100644 index 0000000..c8dc379 --- /dev/null +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -0,0 +1,4 @@ +include(RunCMake) +run_cmake(SkipInstallRulesWarning) +run_cmake(SkipInstallRulesNoWarning1) +run_cmake(SkipInstallRulesNoWarning2) diff --git a/Tests/RunCMake/install/SkipInstallRulesNoWarning1-check.cmake b/Tests/RunCMake/install/SkipInstallRulesNoWarning1-check.cmake new file mode 100644 index 0000000..2807698 --- /dev/null +++ b/Tests/RunCMake/install/SkipInstallRulesNoWarning1-check.cmake @@ -0,0 +1,9 @@ +if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/CMakeCache.txt") + message(FATAL_ERROR "missing test prerequisite CMakeCache.txt") +endif() + +set(CMAKE_INSTALL_CMAKE "${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake") + +if(EXISTS ${CMAKE_INSTALL_CMAKE}) + message(FATAL_ERROR "${CMAKE_INSTALL_CMAKE} should not exist") +endif() diff --git a/Tests/RunCMake/install/SkipInstallRulesNoWarning1-stderr.txt b/Tests/RunCMake/install/SkipInstallRulesNoWarning1-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/install/SkipInstallRulesNoWarning1-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/install/SkipInstallRulesNoWarning1.cmake b/Tests/RunCMake/install/SkipInstallRulesNoWarning1.cmake new file mode 100644 index 0000000..22c7f8c --- /dev/null +++ b/Tests/RunCMake/install/SkipInstallRulesNoWarning1.cmake @@ -0,0 +1 @@ +set(CMAKE_SKIP_INSTALL_RULES ON) diff --git a/Tests/RunCMake/install/SkipInstallRulesNoWarning2-check.cmake b/Tests/RunCMake/install/SkipInstallRulesNoWarning2-check.cmake new file mode 100644 index 0000000..4372b77 --- /dev/null +++ b/Tests/RunCMake/install/SkipInstallRulesNoWarning2-check.cmake @@ -0,0 +1,9 @@ +if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/CMakeCache.txt") + message(FATAL_ERROR "missing test prerequisite CMakeCache.txt") +endif() + +set(CMAKE_INSTALL_CMAKE "${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake") + +if(NOT EXISTS ${CMAKE_INSTALL_CMAKE}) + message(FATAL_ERROR "${CMAKE_INSTALL_CMAKE} should exist") +endif() diff --git a/Tests/RunCMake/install/SkipInstallRulesNoWarning2-stderr.txt b/Tests/RunCMake/install/SkipInstallRulesNoWarning2-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/install/SkipInstallRulesNoWarning2-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/install/SkipInstallRulesNoWarning2.cmake b/Tests/RunCMake/install/SkipInstallRulesNoWarning2.cmake new file mode 100644 index 0000000..2f5f03a --- /dev/null +++ b/Tests/RunCMake/install/SkipInstallRulesNoWarning2.cmake @@ -0,0 +1 @@ +install(FILES CMakeLists.txt DESTINATION src) diff --git a/Tests/RunCMake/install/SkipInstallRulesWarning-check.cmake b/Tests/RunCMake/install/SkipInstallRulesWarning-check.cmake new file mode 100644 index 0000000..2807698 --- /dev/null +++ b/Tests/RunCMake/install/SkipInstallRulesWarning-check.cmake @@ -0,0 +1,9 @@ +if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/CMakeCache.txt") + message(FATAL_ERROR "missing test prerequisite CMakeCache.txt") +endif() + +set(CMAKE_INSTALL_CMAKE "${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake") + +if(EXISTS ${CMAKE_INSTALL_CMAKE}) + message(FATAL_ERROR "${CMAKE_INSTALL_CMAKE} should not exist") +endif() diff --git a/Tests/RunCMake/install/SkipInstallRulesWarning-stderr.txt b/Tests/RunCMake/install/SkipInstallRulesWarning-stderr.txt new file mode 100644 index 0000000..9130526 --- /dev/null +++ b/Tests/RunCMake/install/SkipInstallRulesWarning-stderr.txt @@ -0,0 +1,3 @@ +CMake Warning in CMakeLists.txt: + CMAKE_SKIP_INSTALL_RULES was enabled even though installation rules have + been specified diff --git a/Tests/RunCMake/install/SkipInstallRulesWarning.cmake b/Tests/RunCMake/install/SkipInstallRulesWarning.cmake new file mode 100644 index 0000000..b621d9b --- /dev/null +++ b/Tests/RunCMake/install/SkipInstallRulesWarning.cmake @@ -0,0 +1,2 @@ +set(CMAKE_SKIP_INSTALL_RULES ON) +install(FILES CMakeLists.txt DESTINATION src) diff --git a/Tests/RunCMake/interface_library/CMakeLists.txt b/Tests/RunCMake/interface_library/CMakeLists.txt new file mode 100644 index 0000000..12cd3c7 --- /dev/null +++ b/Tests/RunCMake/interface_library/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.4) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/interface_library/RunCMakeTest.cmake b/Tests/RunCMake/interface_library/RunCMakeTest.cmake new file mode 100644 index 0000000..9ca9a77 --- /dev/null +++ b/Tests/RunCMake/interface_library/RunCMakeTest.cmake @@ -0,0 +1,9 @@ +include(RunCMake) + +run_cmake(invalid_name) +run_cmake(target_commands) +run_cmake(no_shared_libs) +run_cmake(whitelist) +run_cmake(invalid_signature) +run_cmake(genex_link) +run_cmake(add_dependencies) diff --git a/Tests/RunCMake/interface_library/add_dependencies-result.txt b/Tests/RunCMake/interface_library/add_dependencies-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/interface_library/add_dependencies-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/interface_library/add_dependencies-stderr.txt b/Tests/RunCMake/interface_library/add_dependencies-stderr.txt new file mode 100644 index 0000000..c550b68 --- /dev/null +++ b/Tests/RunCMake/interface_library/add_dependencies-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at add_dependencies.cmake:4 \(add_dependencies\): + add_dependencies Cannot add target-level dependencies to INTERFACE library + target "iface". + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/interface_library/add_dependencies.cmake b/Tests/RunCMake/interface_library/add_dependencies.cmake new file mode 100644 index 0000000..12cdfb4 --- /dev/null +++ b/Tests/RunCMake/interface_library/add_dependencies.cmake @@ -0,0 +1,4 @@ + +add_library(foo empty.cpp) +add_library(iface INTERFACE) +add_dependencies(iface foo) diff --git a/Tests/RunCMake/interface_library/genex_link-result.txt b/Tests/RunCMake/interface_library/genex_link-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/interface_library/genex_link-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/interface_library/genex_link-stderr.txt b/Tests/RunCMake/interface_library/genex_link-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/interface_library/genex_link-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/interface_library/genex_link.cmake b/Tests/RunCMake/interface_library/genex_link.cmake new file mode 100644 index 0000000..0dbf029 --- /dev/null +++ b/Tests/RunCMake/interface_library/genex_link.cmake @@ -0,0 +1,22 @@ + +cmake_minimum_required(VERSION 2.8.12.20131125 FATAL_ERROR) + +project(genex_link) + +set(_main_cpp ${CMAKE_CURRENT_BINARY_DIR}/main.cpp) +file(WRITE ${_main_cpp} + "int main(int argc, char** argv) { return 0; }\n" +) + +add_library(foo::bar INTERFACE IMPORTED) +set_target_properties(foo::bar + PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}" + # When not using a generator expression here, no error is generated + INTERFACE_LINK_LIBRARIES "$<$<NOT:$<CONFIG:DEBUG>>:foo_bar.lib>" +) + +add_executable(main ${_main_cpp}) +target_include_directories(main PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") + +target_link_libraries(main foo::bar) diff --git a/Tests/RunCMake/interface_library/invalid_name-result.txt b/Tests/RunCMake/interface_library/invalid_name-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/interface_library/invalid_name-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/interface_library/invalid_name-stderr.txt b/Tests/RunCMake/interface_library/invalid_name-stderr.txt new file mode 100644 index 0000000..e14fcde --- /dev/null +++ b/Tests/RunCMake/interface_library/invalid_name-stderr.txt @@ -0,0 +1,15 @@ +CMake Error at invalid_name.cmake:2 \(add_library\): + add_library Invalid name for INTERFACE library target: if\$ace +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at invalid_name.cmake:4 \(add_library\): + add_library Invalid name for INTERFACE library target: iface::target +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at invalid_name.cmake:6 \(add_library\): + add_library Invalid name for IMPORTED INTERFACE library target: + if\$target_imported +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/interface_library/invalid_name.cmake b/Tests/RunCMake/interface_library/invalid_name.cmake new file mode 100644 index 0000000..9a965aa --- /dev/null +++ b/Tests/RunCMake/interface_library/invalid_name.cmake @@ -0,0 +1,6 @@ + +add_library(if$ace INTERFACE) + +add_library(iface::target INTERFACE) + +add_library(if$target_imported INTERFACE IMPORTED) diff --git a/Tests/RunCMake/interface_library/invalid_signature-result.txt b/Tests/RunCMake/interface_library/invalid_signature-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/interface_library/invalid_signature-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/interface_library/invalid_signature-stderr.txt b/Tests/RunCMake/interface_library/invalid_signature-stderr.txt new file mode 100644 index 0000000..701586a --- /dev/null +++ b/Tests/RunCMake/interface_library/invalid_signature-stderr.txt @@ -0,0 +1,89 @@ +CMake Error at invalid_signature.cmake:2 \(add_library\): + add_library INTERFACE library requires no source arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at invalid_signature.cmake:3 \(add_library\): + add_library INTERFACE library specified with conflicting/multiple types. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at invalid_signature.cmake:4 \(add_library\): + add_library INTERFACE library specified with conflicting/multiple types. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at invalid_signature.cmake:5 \(add_library\): + add_library INTERFACE library specified with conflicting/multiple types. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at invalid_signature.cmake:6 \(add_library\): + add_library INTERFACE library specified with conflicting/multiple types. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at invalid_signature.cmake:7 \(add_library\): + add_library INTERFACE library specified with conflicting/multiple types. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at invalid_signature.cmake:8 \(add_library\): + add_library INTERFACE library specified with conflicting/multiple types. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at invalid_signature.cmake:9 \(add_library\): + add_library INTERFACE library specified with conflicting STATIC type. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at invalid_signature.cmake:10 \(add_library\): + add_library INTERFACE library specified with conflicting SHARED type. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at invalid_signature.cmake:11 \(add_library\): + add_library INTERFACE library specified with conflicting MODULE type. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at invalid_signature.cmake:12 \(add_library\): + add_library INTERFACE library specified with conflicting OBJECT type. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at invalid_signature.cmake:13 \(add_library\): + add_library INTERFACE library specified with conflicting UNKNOWN type. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at invalid_signature.cmake:14 \(add_library\): + add_library INTERFACE library specified with conflicting ALIAS type. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at invalid_signature.cmake:15 \(add_library\): + add_library INTERFACE library specified with conflicting ALIAS type. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at invalid_signature.cmake:16 \(add_library\): + add_library INTERFACE library specified with conflicting/multiple types. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at invalid_signature.cmake:17 \(add_library\): + add_library INTERFACE library may not be used with EXCLUDE_FROM_ALL. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at invalid_signature.cmake:18 \(add_library\): + add_library INTERFACE library may not be used with EXCLUDE_FROM_ALL. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at invalid_signature.cmake:20 \(add_library\): + add_library INTERFACE library requires no source arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/interface_library/invalid_signature.cmake b/Tests/RunCMake/interface_library/invalid_signature.cmake new file mode 100644 index 0000000..67e3267 --- /dev/null +++ b/Tests/RunCMake/interface_library/invalid_signature.cmake @@ -0,0 +1,20 @@ + +add_library(iface1 INTERFACE empty.cpp) +add_library(iface3 STATIC INTERFACE) +add_library(iface4 STATIC INTERFACE empty.cpp) +add_library(iface5 SHARED INTERFACE) +add_library(iface6 MODULE INTERFACE) +add_library(iface7 OBJECT INTERFACE) +add_library(iface8 UNKNOWN INTERFACE) +add_library(iface9 INTERFACE STATIC) +add_library(iface10 INTERFACE SHARED) +add_library(iface11 INTERFACE MODULE) +add_library(iface12 INTERFACE OBJECT) +add_library(iface13 INTERFACE UNKNOWN) +add_library(iface14 INTERFACE ALIAS) +add_library(iface15 ALIAS INTERFACE) +add_library(iface16 INTERFACE INTERFACE) +add_library(iface17 INTERFACE EXCLUDE_FROM_ALL) +add_library(iface18 EXCLUDE_FROM_ALL INTERFACE) +add_library(iface19 GLOBAL INTERFACE) +add_library(iface20 INTERFACE GLOBAL) diff --git a/Tests/RunCMake/interface_library/no_shared_libs-stderr.txt b/Tests/RunCMake/interface_library/no_shared_libs-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/interface_library/no_shared_libs-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/interface_library/no_shared_libs.cmake b/Tests/RunCMake/interface_library/no_shared_libs.cmake new file mode 100644 index 0000000..ed81878 --- /dev/null +++ b/Tests/RunCMake/interface_library/no_shared_libs.cmake @@ -0,0 +1,5 @@ + +cmake_minimum_required(VERSION 2.8.12.20131009) +set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) +add_library(foo INTERFACE) +target_compile_definitions(foo INTERFACE FOO_DEFINE) diff --git a/Tests/RunCMake/interface_library/target_commands-result.txt b/Tests/RunCMake/interface_library/target_commands-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/interface_library/target_commands-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/interface_library/target_commands-stderr.txt b/Tests/RunCMake/interface_library/target_commands-stderr.txt new file mode 100644 index 0000000..be11b77 --- /dev/null +++ b/Tests/RunCMake/interface_library/target_commands-stderr.txt @@ -0,0 +1,47 @@ +CMake Error at target_commands.cmake:4 \(target_link_libraries\): + INTERFACE library can only be used with the INTERFACE keyword of + target_link_libraries +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at target_commands.cmake:5 \(target_link_libraries\): + INTERFACE library can only be used with the INTERFACE keyword of + target_link_libraries +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at target_commands.cmake:6 \(target_link_libraries\): + INTERFACE library can only be used with the INTERFACE keyword of + target_link_libraries +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at target_commands.cmake:7 \(target_link_libraries\): + INTERFACE library can only be used with the INTERFACE keyword of + target_link_libraries +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at target_commands.cmake:9 \(target_include_directories\): + target_include_directories may only be set INTERFACE properties on + INTERFACE targets +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at target_commands.cmake:10 \(target_include_directories\): + target_include_directories may only be set INTERFACE properties on + INTERFACE targets +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at target_commands.cmake:12 \(target_compile_definitions\): + target_compile_definitions may only be set INTERFACE properties on + INTERFACE targets +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at target_commands.cmake:13 \(target_compile_definitions\): + target_compile_definitions may only be set INTERFACE properties on + INTERFACE targets +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/interface_library/target_commands.cmake b/Tests/RunCMake/interface_library/target_commands.cmake new file mode 100644 index 0000000..3182e89 --- /dev/null +++ b/Tests/RunCMake/interface_library/target_commands.cmake @@ -0,0 +1,13 @@ + +add_library(iface INTERFACE) + +target_link_libraries(iface PRIVATE foo) +target_link_libraries(iface PUBLIC foo) +target_link_libraries(iface foo) +target_link_libraries(iface LINK_INTERFACE_LIBRARIES foo) + +target_include_directories(iface PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") +target_include_directories(iface PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") + +target_compile_definitions(iface PRIVATE SOME_DEFINE) +target_compile_definitions(iface PUBLIC SOME_DEFINE) diff --git a/Tests/RunCMake/interface_library/whitelist-result.txt b/Tests/RunCMake/interface_library/whitelist-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/interface_library/whitelist-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/interface_library/whitelist-stderr.txt b/Tests/RunCMake/interface_library/whitelist-stderr.txt new file mode 100644 index 0000000..577c0cc --- /dev/null +++ b/Tests/RunCMake/interface_library/whitelist-stderr.txt @@ -0,0 +1,19 @@ +CMake Error at whitelist.cmake:4 \(set_property\): + INTERFACE_LIBRARY targets may only have whitelisted properties. The + property "OUTPUT_NAME" is not allowed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Error at whitelist.cmake:5 \(set_property\): + INTERFACE_LIBRARY targets may only have whitelisted properties. The + property "OUTPUT_NAME" is not allowed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Error at whitelist.cmake:6 \(get_target_property\): + INTERFACE_LIBRARY targets may only have whitelisted properties. The + property "OUTPUT_NAME" is not allowed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/interface_library/whitelist.cmake b/Tests/RunCMake/interface_library/whitelist.cmake new file mode 100644 index 0000000..98ef05c --- /dev/null +++ b/Tests/RunCMake/interface_library/whitelist.cmake @@ -0,0 +1,6 @@ + +add_library(iface INTERFACE) + +set_property(TARGET iface PROPERTY OUTPUT_NAME output) +set_property(TARGET iface APPEND PROPERTY OUTPUT_NAME append) +get_target_property(outname iface OUTPUT_NAME) diff --git a/Tests/RunCMake/message/CMakeLists.txt b/Tests/RunCMake/message/CMakeLists.txt new file mode 100644 index 0000000..12cd3c7 --- /dev/null +++ b/Tests/RunCMake/message/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.4) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/message/RunCMakeTest.cmake b/Tests/RunCMake/message/RunCMakeTest.cmake new file mode 100644 index 0000000..d2bc0c3 --- /dev/null +++ b/Tests/RunCMake/message/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(nomessage) +run_cmake(warnmessage) +run_cmake(errormessage) diff --git a/Tests/RunCMake/message/errormessage-result.txt b/Tests/RunCMake/message/errormessage-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/message/errormessage-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/message/errormessage-stderr.txt b/Tests/RunCMake/message/errormessage-stderr.txt new file mode 100644 index 0000000..49e7ca9 --- /dev/null +++ b/Tests/RunCMake/message/errormessage-stderr.txt @@ -0,0 +1,4 @@ +CMake Deprecation Error at errormessage.cmake:4 \(message\): + This is an error +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/message/errormessage.cmake b/Tests/RunCMake/message/errormessage.cmake new file mode 100644 index 0000000..7d3b779 --- /dev/null +++ b/Tests/RunCMake/message/errormessage.cmake @@ -0,0 +1,4 @@ + +set(CMAKE_ERROR_DEPRECATED ON) + +message(DEPRECATION "This is an error") diff --git a/Tests/RunCMake/message/nomessage-result.txt b/Tests/RunCMake/message/nomessage-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/message/nomessage-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/message/nomessage-stderr.txt b/Tests/RunCMake/message/nomessage-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/message/nomessage-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/message/nomessage.cmake b/Tests/RunCMake/message/nomessage.cmake new file mode 100644 index 0000000..bcc97be --- /dev/null +++ b/Tests/RunCMake/message/nomessage.cmake @@ -0,0 +1,2 @@ + +message(DEPRECATION "This is not issued") diff --git a/Tests/RunCMake/message/warnmessage-result.txt b/Tests/RunCMake/message/warnmessage-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/message/warnmessage-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/message/warnmessage-stderr.txt b/Tests/RunCMake/message/warnmessage-stderr.txt new file mode 100644 index 0000000..5c44566 --- /dev/null +++ b/Tests/RunCMake/message/warnmessage-stderr.txt @@ -0,0 +1,4 @@ +CMake Deprecation Warning at warnmessage.cmake:4 \(message\): + This is a warning +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/message/warnmessage.cmake b/Tests/RunCMake/message/warnmessage.cmake new file mode 100644 index 0000000..4c421a1 --- /dev/null +++ b/Tests/RunCMake/message/warnmessage.cmake @@ -0,0 +1,4 @@ + +set(CMAKE_WARN_DEPRECATED ON) + +message(DEPRECATION "This is a warning") diff --git a/Tests/RunCMake/no_install_prefix/CMakeLists.txt b/Tests/RunCMake/no_install_prefix/CMakeLists.txt new file mode 100644 index 0000000..12cd3c7 --- /dev/null +++ b/Tests/RunCMake/no_install_prefix/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.4) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/no_install_prefix/RunCMakeTest.cmake b/Tests/RunCMake/no_install_prefix/RunCMakeTest.cmake new file mode 100644 index 0000000..2923449 --- /dev/null +++ b/Tests/RunCMake/no_install_prefix/RunCMakeTest.cmake @@ -0,0 +1,15 @@ +include(RunCMake) + +set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/prefix") + +file(REMOVE_RECURSE "${RunCMake_BINARY_DIR}/prefix") +file(MAKE_DIRECTORY "${RunCMake_BINARY_DIR}/prefix/NoPrefix") +file(WRITE "${RunCMake_BINARY_DIR}/prefix/NoPrefix/NoPrefixConfig.cmake" "") +set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_BINARY_DIR}/prefix") +run_cmake(with_install_prefix) + +file(REMOVE_RECURSE "${RunCMake_BINARY_DIR}/prefix") +file(MAKE_DIRECTORY "${RunCMake_BINARY_DIR}/prefix/NoPrefix") +file(WRITE "${RunCMake_BINARY_DIR}/prefix/NoPrefix/NoPrefixConfig.cmake" "") +list(APPEND RunCMake_TEST_OPTIONS "-DCMAKE_FIND_NO_INSTALL_PREFIX=1") +run_cmake(no_install_prefix) diff --git a/Tests/RunCMake/no_install_prefix/do_test.cmake b/Tests/RunCMake/no_install_prefix/do_test.cmake new file mode 100644 index 0000000..340c7dc --- /dev/null +++ b/Tests/RunCMake/no_install_prefix/do_test.cmake @@ -0,0 +1,2 @@ + +find_package(NoPrefix REQUIRED) diff --git a/Tests/RunCMake/no_install_prefix/no_install_prefix-result.txt b/Tests/RunCMake/no_install_prefix/no_install_prefix-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/no_install_prefix/no_install_prefix-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/no_install_prefix/no_install_prefix-stderr.txt b/Tests/RunCMake/no_install_prefix/no_install_prefix-stderr.txt new file mode 100644 index 0000000..66c6241 --- /dev/null +++ b/Tests/RunCMake/no_install_prefix/no_install_prefix-stderr.txt @@ -0,0 +1,18 @@ +CMake Error at do_test.cmake:2 \(find_package\): + By not providing "FindNoPrefix.cmake" in CMAKE_MODULE_PATH this project has + asked CMake to find a package configuration file provided by "NoPrefix", + but CMake did not find one. + + Could not find a package configuration file provided by "NoPrefix" with any + of the following names: + + NoPrefixConfig.cmake + noprefix-config.cmake + + Add the installation prefix of "NoPrefix" to CMAKE_PREFIX_PATH or set + "NoPrefix_DIR" to a directory containing one of the above files. If + "NoPrefix" provides a separate development package or SDK, be sure it has + been installed. +Call Stack \(most recent call first\): + no_install_prefix.cmake:2 \(include\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/no_install_prefix/no_install_prefix.cmake b/Tests/RunCMake/no_install_prefix/no_install_prefix.cmake new file mode 100644 index 0000000..c7d28da --- /dev/null +++ b/Tests/RunCMake/no_install_prefix/no_install_prefix.cmake @@ -0,0 +1,2 @@ + +include(do_test.cmake) diff --git a/Tests/RunCMake/no_install_prefix/with_install_prefix-result.txt b/Tests/RunCMake/no_install_prefix/with_install_prefix-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/no_install_prefix/with_install_prefix-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/no_install_prefix/with_install_prefix-stderr.txt b/Tests/RunCMake/no_install_prefix/with_install_prefix-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/no_install_prefix/with_install_prefix-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/no_install_prefix/with_install_prefix.cmake b/Tests/RunCMake/no_install_prefix/with_install_prefix.cmake new file mode 100644 index 0000000..c7d28da --- /dev/null +++ b/Tests/RunCMake/no_install_prefix/with_install_prefix.cmake @@ -0,0 +1,2 @@ + +include(do_test.cmake) diff --git a/Tests/RunCMake/set/CMakeLists.txt b/Tests/RunCMake/set/CMakeLists.txt new file mode 100644 index 0000000..4b3de84 --- /dev/null +++ b/Tests/RunCMake/set/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.12) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/set/PARENT_SCOPE-result.txt b/Tests/RunCMake/set/PARENT_SCOPE-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/set/PARENT_SCOPE-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/set/PARENT_SCOPE.cmake b/Tests/RunCMake/set/PARENT_SCOPE.cmake new file mode 100644 index 0000000..9bd6bca --- /dev/null +++ b/Tests/RunCMake/set/PARENT_SCOPE.cmake @@ -0,0 +1,33 @@ +set(FOO ) +set(BAR "bar") +set(BAZ "baz") +set(BOO "boo") + +function(_parent_scope) + set(FOO "foo" PARENT_SCOPE) + set(BAR "" PARENT_SCOPE) + set(BAZ PARENT_SCOPE) + unset(BOO PARENT_SCOPE) +endfunction() + +_parent_scope() + +if(NOT DEFINED FOO) + message(FATAL_ERROR "FOO not defined") +elseif(NOT "${FOO}" STREQUAL "foo") + message(FATAL_ERROR "FOO should be \"foo\", not \"${FOO}\"") +endif() + +if(NOT DEFINED BAR) + message(FATAL_ERROR "BAR not defined") +elseif(NOT "${BAR}" STREQUAL "") + message(FATAL_ERROR "BAR should be an empty string, not \"${BAR}\"") +endif() + +if(DEFINED BAZ) + message(FATAL_ERROR "BAZ defined") +endif() + +if(DEFINED BOO) + message(FATAL_ERROR "BOO defined") +endif() diff --git a/Tests/RunCMake/set/RunCMakeTest.cmake b/Tests/RunCMake/set/RunCMakeTest.cmake new file mode 100644 index 0000000..5d036e3 --- /dev/null +++ b/Tests/RunCMake/set/RunCMakeTest.cmake @@ -0,0 +1,3 @@ +include(RunCMake) + +run_cmake(PARENT_SCOPE) diff --git a/Tests/RunCMake/string/CMakeLists.txt b/Tests/RunCMake/string/CMakeLists.txt new file mode 100644 index 0000000..12cd3c7 --- /dev/null +++ b/Tests/RunCMake/string/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.4) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/string/Concat.cmake b/Tests/RunCMake/string/Concat.cmake new file mode 100644 index 0000000..7260c95 --- /dev/null +++ b/Tests/RunCMake/string/Concat.cmake @@ -0,0 +1,19 @@ +set(b b) +set(out x) +string(CONCAT out) +if(NOT out STREQUAL "") + message(FATAL_ERROR "\"string(CONCAT out)\" set out to \"${out}\"") +endif() +string(CONCAT out a) +if(NOT out STREQUAL "a") + message(FATAL_ERROR "\"string(CONCAT out a)\" set out to \"${out}\"") +endif() +string(CONCAT out a "b") +if(NOT out STREQUAL "ab") + message(FATAL_ERROR "\"string(CONCAT out a \"b\")\" set out to \"${out}\"") +endif() +string(CONCAT out a "${b}" [[ +${c}]]) +if(NOT out STREQUAL "ab\${c}") + message(FATAL_ERROR "\"string(CONCAT out a \"\${b}\" [[\${c}]])\" set out to \"${out}\"") +endif() diff --git a/Tests/RunCMake/string/ConcatNoArgs-result.txt b/Tests/RunCMake/string/ConcatNoArgs-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/string/ConcatNoArgs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/string/ConcatNoArgs-stderr.txt b/Tests/RunCMake/string/ConcatNoArgs-stderr.txt new file mode 100644 index 0000000..efea5f1 --- /dev/null +++ b/Tests/RunCMake/string/ConcatNoArgs-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at ConcatNoArgs.cmake:1 \(string\): + string sub-command CONCAT requires at least one argument. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/string/ConcatNoArgs.cmake b/Tests/RunCMake/string/ConcatNoArgs.cmake new file mode 100644 index 0000000..ba21136 --- /dev/null +++ b/Tests/RunCMake/string/ConcatNoArgs.cmake @@ -0,0 +1 @@ +string(CONCAT) diff --git a/Tests/RunCMake/string/RunCMakeTest.cmake b/Tests/RunCMake/string/RunCMakeTest.cmake new file mode 100644 index 0000000..501acd2 --- /dev/null +++ b/Tests/RunCMake/string/RunCMakeTest.cmake @@ -0,0 +1,4 @@ +include(RunCMake) + +run_cmake(Concat) +run_cmake(ConcatNoArgs) diff --git a/Tests/SimpleInstall/CMakeLists.txt b/Tests/SimpleInstall/CMakeLists.txt index b969bfd..cc3c3be 100644 --- a/Tests/SimpleInstall/CMakeLists.txt +++ b/Tests/SimpleInstall/CMakeLists.txt @@ -308,7 +308,7 @@ else() endif() if(CMAKE_CONFIGURATION_TYPES) - set(SI_CONFIG -C ${CMAKE_CFG_INTDIR}) + set(SI_CONFIG --config $<CONFIGURATION>) else() set(SI_CONFIG) endif() @@ -367,7 +367,9 @@ set(CMAKE_INSTALL_DEBUG_LIBRARIES 1) include(InstallRequiredSystemLibraries) if(CTEST_TEST_CPACK) - set(PACKAGE_TARGET --build-target package) + set(package_command COMMAND + ${CMAKE_COMMAND} --build . --target package ${SI_CONFIG} + ) # Avoid settings that require the .zip file command line tools... # (just build an NSIS installer without component support) @@ -375,24 +377,19 @@ if(CTEST_TEST_CPACK) set(CPACK_BINARY_ZIP OFF) set(CPACK_MONOLITHIC_INSTALL ON) else() - set(PACKAGE_TARGET) + set(package_command) endif() include(CPack) +set(install_command COMMAND + ${CMAKE_COMMAND} --build . --target install ${SI_CONFIG} + ) + add_custom_command( TARGET ${install_target} POST_BUILD - COMMAND ${CMAKE_CTEST_COMMAND} - ARGS ${SI_CONFIG} - --build-and-test - ${CMAKE_SOURCE_DIR} - ${CMAKE_BINARY_DIR} - --build-generator ${CMAKE_GENERATOR} - --build-project ${PROJECT_NAME} - --build-makeprogram ${CMAKE_MAKE_PROGRAM} - --build-noclean - --build-target install - ${PACKAGE_TARGET} + ${install_command} + ${package_command} COMMENT "Install Project" ) diff --git a/Tests/SimpleInstallS2/CMakeLists.txt b/Tests/SimpleInstallS2/CMakeLists.txt index b969bfd..cc3c3be 100644 --- a/Tests/SimpleInstallS2/CMakeLists.txt +++ b/Tests/SimpleInstallS2/CMakeLists.txt @@ -308,7 +308,7 @@ else() endif() if(CMAKE_CONFIGURATION_TYPES) - set(SI_CONFIG -C ${CMAKE_CFG_INTDIR}) + set(SI_CONFIG --config $<CONFIGURATION>) else() set(SI_CONFIG) endif() @@ -367,7 +367,9 @@ set(CMAKE_INSTALL_DEBUG_LIBRARIES 1) include(InstallRequiredSystemLibraries) if(CTEST_TEST_CPACK) - set(PACKAGE_TARGET --build-target package) + set(package_command COMMAND + ${CMAKE_COMMAND} --build . --target package ${SI_CONFIG} + ) # Avoid settings that require the .zip file command line tools... # (just build an NSIS installer without component support) @@ -375,24 +377,19 @@ if(CTEST_TEST_CPACK) set(CPACK_BINARY_ZIP OFF) set(CPACK_MONOLITHIC_INSTALL ON) else() - set(PACKAGE_TARGET) + set(package_command) endif() include(CPack) +set(install_command COMMAND + ${CMAKE_COMMAND} --build . --target install ${SI_CONFIG} + ) + add_custom_command( TARGET ${install_target} POST_BUILD - COMMAND ${CMAKE_CTEST_COMMAND} - ARGS ${SI_CONFIG} - --build-and-test - ${CMAKE_SOURCE_DIR} - ${CMAKE_BINARY_DIR} - --build-generator ${CMAKE_GENERATOR} - --build-project ${PROJECT_NAME} - --build-makeprogram ${CMAKE_MAKE_PROGRAM} - --build-noclean - --build-target install - ${PACKAGE_TARGET} + ${install_command} + ${package_command} COMMENT "Install Project" ) diff --git a/Tests/StagingPrefix/CMakeLists.txt b/Tests/StagingPrefix/CMakeLists.txt new file mode 100644 index 0000000..922776d --- /dev/null +++ b/Tests/StagingPrefix/CMakeLists.txt @@ -0,0 +1,89 @@ + +cmake_minimum_required(VERSION 2.8.12) +project(StagingPrefix) + +# Wipe out the install tree +add_custom_command( + OUTPUT ${CMAKE_BINARY_DIR}/CleanupProject + COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/ConsumerBuild + COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/ProducerBuild + COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/stage + COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/prefix + COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/ignored + ) +add_custom_target(CleanupTarget ALL DEPENDS ${CMAKE_BINARY_DIR}/CleanupProject) +set_property( + SOURCE ${CMAKE_BINARY_DIR}/CleanupProject + PROPERTY SYMBOLIC 1 + ) + +if(CMAKE_CONFIGURATION_TYPES) + set(NESTED_CONFIG_TYPE -C "${CMAKE_CFG_INTDIR}") +else() + if(CMAKE_BUILD_TYPE) + set(NESTED_CONFIG_TYPE -C "${CMAKE_BUILD_TYPE}") + else() + set(NESTED_CONFIG_TYPE) + endif() +endif() + +# Build and install the producer. +add_custom_command( + OUTPUT ${CMAKE_BINARY_DIR}/ProducerProject + COMMAND ${CMAKE_CTEST_COMMAND} ${NESTED_CONFIG_TYPE} + --build-and-test + ${CMAKE_SOURCE_DIR}/Producer + ${CMAKE_BINARY_DIR}/ProducerBuild + --build-noclean + --build-project Producer + --build-target install + --build-generator ${CMAKE_GENERATOR} + --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" + --build-options + -DCMAKE_VERBOSE_MAKEFILE=1 + "-DCMAKE_STAGING_PREFIX=${CMAKE_BINARY_DIR}/stage" + "-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/prefix" + VERBATIM + ) + +add_custom_target(ProducerTarget ALL DEPENDS ${CMAKE_BINARY_DIR}/ProducerProject) +add_dependencies(ProducerTarget CleanupTarget) +set_property( + SOURCE ${CMAKE_BINARY_DIR}/ProducerProject + PROPERTY SYMBOLIC 1 + ) + +if(NOT WIN32) + file(WRITE + "${CMAKE_BINARY_DIR}/ignored/${CMAKE_BINARY_DIR}/stage/include/ignored.h" + "#define IGNORED\n" + ) +endif() + +# Build and install the consumer. +add_custom_command( + OUTPUT ${CMAKE_BINARY_DIR}/ConsumerProject + COMMAND ${CMAKE_CTEST_COMMAND} ${NESTED_CONFIG_TYPE} + --build-and-test + ${CMAKE_SOURCE_DIR}/Consumer + ${CMAKE_BINARY_DIR}/ConsumerBuild + --build-noclean + --build-project Consumer + --build-target install + --build-generator ${CMAKE_GENERATOR} + --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" + --build-options + "-DCMAKE_FIND_ROOT_PATH=${CMAKE_BINARY_DIR}/ignored" + "-DCMAKE_STAGING_PREFIX=${CMAKE_BINARY_DIR}/stage" + -DCMAKE_VERBOSE_MAKEFILE=1 + VERBATIM + ) +add_custom_target(ConsumerTarget ALL DEPENDS ${CMAKE_BINARY_DIR}/ConsumerProject) +add_dependencies(ConsumerTarget ProducerTarget) +set_property( + SOURCE ${CMAKE_BINARY_DIR}/ConsumerProject + PROPERTY SYMBOLIC 1 + ) + +add_executable(StagingPrefix main.cpp) +add_dependencies(StagingPrefix ConsumerTarget) diff --git a/Tests/StagingPrefix/Consumer/CMakeLists.txt b/Tests/StagingPrefix/Consumer/CMakeLists.txt new file mode 100644 index 0000000..a230441 --- /dev/null +++ b/Tests/StagingPrefix/Consumer/CMakeLists.txt @@ -0,0 +1,22 @@ + +cmake_minimum_required (VERSION 2.8.12) +project(Consumer) + + +add_executable(executable main.cpp) +find_package(Foo CONFIG REQUIRED) +target_link_libraries(executable Foo::foo) + +set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") +find_package(Bar MODULE REQUIRED) +include_directories(${Bar_INCLUDE_DIRS}) +target_link_libraries(executable ${Bar_LIBRARIES}) + +install(TARGETS executable DESTINATION bin) + +if(NOT WIN32) + find_path(IGNORED_INCLUDE_DIR ignored.h) + if (IGNORED_INCLUDE_DIR) + message(SEND_ERROR "Should not find this file. The search path should be excluded.") + endif() +endif() diff --git a/Tests/StagingPrefix/Consumer/cmake/FindBar.cmake b/Tests/StagingPrefix/Consumer/cmake/FindBar.cmake new file mode 100644 index 0000000..29e4478 --- /dev/null +++ b/Tests/StagingPrefix/Consumer/cmake/FindBar.cmake @@ -0,0 +1,6 @@ + +find_path(_inc_prefix bar.h PATH_SUFFIXES bar) +set(Bar_INCLUDE_DIRS ${_inc_prefix}) + +find_library(Bar_LIBRARY bar) +set(Bar_LIBRARIES ${Bar_LIBRARY}) diff --git a/Tests/StagingPrefix/Consumer/main.cpp b/Tests/StagingPrefix/Consumer/main.cpp new file mode 100644 index 0000000..612ee05 --- /dev/null +++ b/Tests/StagingPrefix/Consumer/main.cpp @@ -0,0 +1,10 @@ + +#include "foo.h" +#include "bar.h" + +int main(int, char **) +{ + Foo f; + Bar b; + return f.foo() + b.bar(); +} diff --git a/Tests/StagingPrefix/Producer/CMakeLists.txt b/Tests/StagingPrefix/Producer/CMakeLists.txt new file mode 100644 index 0000000..eb3d98f --- /dev/null +++ b/Tests/StagingPrefix/Producer/CMakeLists.txt @@ -0,0 +1,26 @@ + +cmake_minimum_required (VERSION 2.8.12) +project(Producer) + +add_library(foo SHARED foo.cpp) + +install(TARGETS foo EXPORT fooTargets + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + INCLUDES DESTINATION include/foo +) +install(FILES foo.h DESTINATION include/foo) +install(EXPORT fooTargets + FILE FooConfig.cmake + NAMESPACE Foo:: + DESTINATION lib/cmake/Foo +) + +add_library(bar SHARED bar.cpp) +install(TARGETS bar + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) +install(FILES bar.h DESTINATION include/bar) diff --git a/Tests/StagingPrefix/Producer/bar.cpp b/Tests/StagingPrefix/Producer/bar.cpp new file mode 100644 index 0000000..6bb8abe --- /dev/null +++ b/Tests/StagingPrefix/Producer/bar.cpp @@ -0,0 +1,7 @@ + +#include "bar.h" + +int Bar::bar() +{ + return 0; +} diff --git a/Tests/StagingPrefix/Producer/bar.h b/Tests/StagingPrefix/Producer/bar.h new file mode 100644 index 0000000..acd1fae --- /dev/null +++ b/Tests/StagingPrefix/Producer/bar.h @@ -0,0 +1,10 @@ + +class +#ifdef _WIN32 +__declspec(dllexport) +#endif +Bar +{ +public: + int bar(); +}; diff --git a/Tests/StagingPrefix/Producer/foo.cpp b/Tests/StagingPrefix/Producer/foo.cpp new file mode 100644 index 0000000..64ad7cd --- /dev/null +++ b/Tests/StagingPrefix/Producer/foo.cpp @@ -0,0 +1,7 @@ + +#include "foo.h" + +int Foo::foo() +{ + return 0; +} diff --git a/Tests/StagingPrefix/Producer/foo.h b/Tests/StagingPrefix/Producer/foo.h new file mode 100644 index 0000000..614093d --- /dev/null +++ b/Tests/StagingPrefix/Producer/foo.h @@ -0,0 +1,10 @@ + +class +#ifdef _WIN32 +__declspec(dllexport) +#endif +Foo +{ +public: + int foo(); +}; diff --git a/Tests/StagingPrefix/main.cpp b/Tests/StagingPrefix/main.cpp new file mode 100644 index 0000000..341aaaf --- /dev/null +++ b/Tests/StagingPrefix/main.cpp @@ -0,0 +1,5 @@ + +int main(int, char **) +{ + return 0; +} diff --git a/Tests/TestInstall.sh.in b/Tests/TestInstall.sh.in deleted file mode 100755 index 9535780..0000000 --- a/Tests/TestInstall.sh.in +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/sh - -CMAKE_COMMAND="@CMAKE_INSTALL_PREFIX@/bin/cmake" -CMake_SOURCE_DIR="@CMake_SOURCE_DIR@" -CMake_BINARY_DIR="@CMake_BINARY_DIR@" -CMAKE_INSTALL_PREFIX="@CMAKE_INSTALL_PREFIX@" -CMAKE_BUILD_TOOL="@CMAKE_BUILD_TOOL@" - -SOURCE_DIR="${CMake_SOURCE_DIR}/Tests/Simple" -BINARY_DIR="${CMake_BINARY_DIR}/Tests/TestInstall" - -install() -{ - echo "Erasing ${CMAKE_INSTALL_PREFIX}" && - ([ ! -d "${CMAKE_INSTALL_PREFIX}" ] || rm -rf "${CMAKE_INSTALL_PREFIX}") && - mkdir -p "${CMAKE_INSTALL_PREFIX}" && - echo "Running make install" && - ( - cd "${CMake_BINARY_DIR}" && - "${CMAKE_BUILD_TOOL}" install - ) -} - -setup() -{ - echo "Entering ${BINARY_DIR}" && - cd "${BINARY_DIR}" -} - -write_cache() -{ - install || return 1 - setup || return 1 - echo "Writing CMakeCache.txt" - ( - cat > CMakeCache.txt <<EOF -EOF - ) -} - -run_cmake() -{ - write_cache || return 1 - echo "Running CMake" - "${CMAKE_COMMAND}" "${SOURCE_DIR}" -} - -run_make() -{ - run_cmake || return 1 - echo "Running ${CMAKE_BUILD_TOOL}" - "${CMAKE_BUILD_TOOL}" -} - -run_test() -{ - echo "Running ${BINARY_DIR}/simple" - ( - "${BINARY_DIR}/simple" - ) -} - -run_make && run_test diff --git a/Tests/Tutorial/Step6/MathFunctions/CMakeLists.txt b/Tests/Tutorial/Step6/MathFunctions/CMakeLists.txt index 9961e69..70a35f6 100644 --- a/Tests/Tutorial/Step6/MathFunctions/CMakeLists.txt +++ b/Tests/Tutorial/Step6/MathFunctions/CMakeLists.txt @@ -1,13 +1,11 @@ # first we add the executable that generates the table add_executable(MakeTable MakeTable.cxx) -get_target_property(MakeTableLocation MakeTable LOCATION) - # add the command to generate the source code add_custom_command ( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h DEPENDS MakeTable - COMMAND ${MakeTableLocation} + COMMAND MakeTable ARGS ${CMAKE_CURRENT_BINARY_DIR}/Table.h ) diff --git a/Tests/Tutorial/Step7/MathFunctions/CMakeLists.txt b/Tests/Tutorial/Step7/MathFunctions/CMakeLists.txt index 9961e69..70a35f6 100644 --- a/Tests/Tutorial/Step7/MathFunctions/CMakeLists.txt +++ b/Tests/Tutorial/Step7/MathFunctions/CMakeLists.txt @@ -1,13 +1,11 @@ # first we add the executable that generates the table add_executable(MakeTable MakeTable.cxx) -get_target_property(MakeTableLocation MakeTable LOCATION) - # add the command to generate the source code add_custom_command ( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h DEPENDS MakeTable - COMMAND ${MakeTableLocation} + COMMAND MakeTable ARGS ${CMAKE_CURRENT_BINARY_DIR}/Table.h ) diff --git a/Tests/Unset/CMakeLists.txt b/Tests/Unset/CMakeLists.txt index 781da3f..07aa68e 100644 --- a/Tests/Unset/CMakeLists.txt +++ b/Tests/Unset/CMakeLists.txt @@ -51,5 +51,32 @@ if(DEFINED BAR) message(FATAL_ERROR "BAR still defined") endif() +# Test unset(... PARENT_SCOPE) +function(unset_zots) + if(NOT DEFINED ZOT1) + message(FATAL_ERROR "ZOT1 is not defined inside function") + endif() + if(NOT DEFINED ZOT2) + message(FATAL_ERROR "ZOT2 is not defined inside function") + endif() + unset(ZOT1) + unset(ZOT2 PARENT_SCOPE) + if(DEFINED ZOT1) + message(FATAL_ERROR "ZOT1 is defined inside function after unset") + endif() + if(NOT DEFINED ZOT2) + message(FATAL_ERROR + "ZOT2 is not defined inside function after unset(... PARENT_SCOPE)") + endif() +endfunction() +set(ZOT1 1) +set(ZOT2 2) +unset_zots() +if(NOT DEFINED ZOT1) + message(FATAL_ERROR "ZOT1 is not still defined after function") +endif() +if(DEFINED ZOT2) + message(FATAL_ERROR "ZOT2 is still defined after function unset PARENT_SCOPE") +endif() add_executable(Unset unset.c) diff --git a/Tests/Wrapping/CMakeLists.txt b/Tests/Wrapping/CMakeLists.txt index 58e9c32..cbb28a1 100644 --- a/Tests/Wrapping/CMakeLists.txt +++ b/Tests/Wrapping/CMakeLists.txt @@ -54,7 +54,7 @@ if (QT_FOUND AND QT_WRAP_UI) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/foo.ui.in - ${CMAKE_CURRENT_BINARY_DIR}/foo.ui IMMEDIATE) + ${CMAKE_CURRENT_BINARY_DIR}/foo.ui) set (QT_WRAP_UI "On") set (QT_UIC_EXE "${QT_UIC_EXECUTABLE}") @@ -89,9 +89,8 @@ set (FLTK_SRCS fltk1.fl ) add_executable(fakefluid fakefluid.cxx) -get_target_property(FLUID_LOC fakefluid LOCATION) set (FLTK_WRAP_UI "On") -set (FLTK_FLUID_EXECUTABLE "${FLUID_LOC}") +set (FLTK_FLUID_EXECUTABLE fakefluid) fltk_wrap_ui (wraplibFLTK ${FLTK_SRCS}) add_library(wraplibFLTK ${wraplibFLTK_FLTK_UI_SRCS}) add_dependencies(wraplibFLTK fakefluid) @@ -102,6 +101,6 @@ add_dependencies(fakefluid Wrap) configure_file( ${Wrapping_SOURCE_DIR}/dummy ${Wrapping_BINARY_DIR}/gl.h - COPYONLY IMMEDIATE) + COPYONLY) use_mangled_mesa (${Wrapping_BINARY_DIR} ${Wrapping_BINARY_DIR}/mangled_mesa) |