diff options
Diffstat (limited to 'Tests')
560 files changed, 4806 insertions, 455 deletions
diff --git a/Tests/AliasTarget/CMakeLists.txt b/Tests/AliasTarget/CMakeLists.txt index a5eb0f6..fdb1638 100644 --- a/Tests/AliasTarget/CMakeLists.txt +++ b/Tests/AliasTarget/CMakeLists.txt @@ -45,3 +45,6 @@ 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) diff --git a/Tests/Assembler/CMakeLists.txt b/Tests/Assembler/CMakeLists.txt index bb4bccc..1f07dc9 100644 --- a/Tests/Assembler/CMakeLists.txt +++ b/Tests/Assembler/CMakeLists.txt @@ -9,7 +9,7 @@ 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};") 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/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..33757b6 100644 --- a/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt @@ -22,6 +22,9 @@ 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) 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..7c939ed 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -246,6 +246,7 @@ if(BUILD_TESTING) ADD_TEST_MACRO(CompileOptions CompileOptions) ADD_TEST_MACRO(CompatibleInterface CompatibleInterface) ADD_TEST_MACRO(AliasTarget AliasTarget) + 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) @@ -260,10 +261,27 @@ if(BUILD_TESTING) PASS_REGULAR_EXPRESSION "(file is not of required architecture|does not match cputype|not the architecture being linked)") endif() + if(CMAKE_TEST_GENERATOR MATCHES Make) + set(InterfaceBuildTargets_libname testlib) + if (CMAKE_TEST_GENERATOR MATCHES "Borland|Watcom") + set(InterfaceBuildTargets_libname testlib.lib) + endif() + add_test(InterfaceBuildTargets ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/InterfaceBuildTargets" + "${CMake_BINARY_DIR}/Tests/InterfaceBuildTargets" + --build-two-config + ${build_generator_args} + --build-project InterfaceBuildTargets + --test-command ${CMAKE_CMAKE_COMMAND} -E touch_nocreate ${InterfaceBuildTargets_libname} + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/InterfaceBuildTargets") + endif() + list(APPEND TEST_BUILD_DIRS ${CMake_TEST_INSTALL_PREFIX}) if(NOT QT4_FOUND) - find_package(Qt4) + find_package(Qt4 QUIET) endif() if(QT4_FOUND) @@ -507,9 +525,6 @@ if(BUILD_TESTING) 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) @@ -604,6 +619,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ${build_generator_args} --build-project GeneratorExpression --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") @@ -1013,34 +1029,43 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ) 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) + else() + set(run_autogen_test QtAutogen) + 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 + --test-command ${run_autogen_test} ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt5Automoc") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt5Autogen") 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 + --test-command ${run_autogen_test} ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4Automoc") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4Autogen") add_test(Qt4Targets ${CMAKE_CTEST_COMMAND} --build-and-test @@ -1070,6 +1095,11 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ 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" @@ -1856,6 +1886,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( @@ -1959,12 +2009,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 +2052,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) @@ -2056,6 +2120,9 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --output-log "${CMake_BINARY_DIR}/Tests/CTestTestParallel/testOutput.log" ) + ADD_TEST_MACRO(CTestTestSerialInDepends ${CMAKE_CTEST_COMMAND} -j 4 + --output-on-failure -C "\${CTestTest_CONFIG}") + if(NOT BORLAND) set(CTestLimitDashJ_EXTRA_OPTIONS --force-new-ctest-process) add_test_macro(CTestLimitDashJ ${CMAKE_CTEST_COMMAND} -j 4 @@ -2139,6 +2206,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 +2272,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 +2344,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) @@ -2493,11 +2569,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 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..4c49c6a 100644 --- a/Tests/CMakeTests/CMakeLists.txt +++ b/Tests/CMakeTests/CMakeLists.txt @@ -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/CPackWiXGenerator/CMakeLists.txt b/Tests/CPackWiXGenerator/CMakeLists.txt index 475e60d..b54925a 100644 --- a/Tests/CPackWiXGenerator/CMakeLists.txt +++ b/Tests/CPackWiXGenerator/CMakeLists.txt @@ -4,15 +4,17 @@ 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 my-other-app RUNTIME DESTINATION bin COMPONENT applications) @@ -36,7 +38,11 @@ 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" +) include(CPack) 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/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/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..b5162c9 100644 --- a/Tests/CTestTestMemcheck/CMakeLists.txt +++ b/Tests/CTestTestMemcheck/CMakeLists.txt @@ -35,14 +35,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 +163,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,7 +174,7 @@ 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") 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/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..ae8fda2 100644 --- a/Tests/CTestUpdateCommon.cmake +++ b/Tests/CTestUpdateCommon.cmake @@ -216,7 +216,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..f23bd11 --- /dev/null +++ b/Tests/CTestUpdateP4.cmake.in @@ -0,0 +1,260 @@ +# 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. +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..8186c61 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,25 @@ 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 +) +set_property(TARGET iface1 APPEND PROPERTY + COMPATIBLE_INTERFACE_NUMBER_MAX + 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_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 +47,10 @@ 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) target_compile_definitions(CompatibleInterface PRIVATE @@ -42,6 +60,10 @@ 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> + $<$<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..fa299e9 100644 --- a/Tests/CompatibleInterface/main.cpp +++ b/Tests/CompatibleInterface/main.cpp @@ -23,6 +23,19 @@ #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>) +}; + #include "iface2.h" int main(int argc, char **argv) diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt index 50dccbe..6711147 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. 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..1abf45d 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. 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/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt index 30daa7d..ff96add 100644 --- a/Tests/CustomCommand/CMakeLists.txt +++ b/Tests/CustomCommand/CMakeLists.txt @@ -449,3 +449,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/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index 72ae78f..cbae967 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -298,6 +298,14 @@ 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 @@ -366,6 +374,7 @@ install( testLib6 testLibCycleA testLibCycleB cmp0022NEW cmp0022OLD + systemlib EXPORT exp RUNTIME DESTINATION bin LIBRARY DESTINATION lib NAMELINK_SKIP @@ -417,6 +426,7 @@ export(TARGETS testExe1 testLib1 testLib2 testLib3 testSharedLibRequired testSharedLibRequiredUser testSharedLibRequiredUser2 testSharedLibDepends renamed_on_export cmp0022NEW cmp0022OLD + systemlib NAMESPACE bld_ FILE ExportBuildTree.cmake ) @@ -426,3 +436,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..b713262 --- /dev/null +++ b/Tests/ExportImport/Export/Interface/CMakeLists.txt @@ -0,0 +1,49 @@ + +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) + +export(TARGETS sharediface sharedlib headeronly + NAMESPACE bld:: + FILE ../ExportInterfaceBuildTree.cmake +) + +install(TARGETS headeronly sharediface 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) 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/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/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..c91d8a0 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@" diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt index 4d8d7ed..e0df8c2 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. @@ -186,7 +188,40 @@ 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> -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$") diff --git a/Tests/GeneratorExpression/check-part3.cmake b/Tests/GeneratorExpression/check-part3.cmake index 74a596c..93ea487 100644 --- a/Tests/GeneratorExpression/check-part3.cmake +++ b/Tests/GeneratorExpression/check-part3.cmake @@ -26,3 +26,11 @@ 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() 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..1f5c93b 100644 --- a/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt +++ b/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt @@ -17,3 +17,31 @@ 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) + +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/InterfaceBuildTargets/CMakeLists.txt b/Tests/InterfaceBuildTargets/CMakeLists.txt new file mode 100644 index 0000000..a00e5d5 --- /dev/null +++ b/Tests/InterfaceBuildTargets/CMakeLists.txt @@ -0,0 +1,13 @@ +project(InterfaceBuildTargets) + +add_library(testlib EXCLUDE_FROM_ALL testlib.cxx) +set_property(TARGET testlib PROPERTY PREFIX "") +if(CMAKE_GENERATOR MATCHES "Borland|Watcom") + # These librarians add the .lib suffix anyway. + set_property(TARGET testlib PROPERTY SUFFIX ".lib") +else() + set_property(TARGET testlib PROPERTY SUFFIX "") +endif() + +add_library(iface INTERFACE) +target_link_libraries(iface INTERFACE testlib) diff --git a/Tests/InterfaceBuildTargets/main.cxx b/Tests/InterfaceBuildTargets/main.cxx new file mode 100644 index 0000000..e9ad257 --- /dev/null +++ b/Tests/InterfaceBuildTargets/main.cxx @@ -0,0 +1,5 @@ + +int main(int, char**) +{ + return 0; +} diff --git a/Tests/InterfaceBuildTargets/testlib.cxx b/Tests/InterfaceBuildTargets/testlib.cxx new file mode 100644 index 0000000..02bd6b0 --- /dev/null +++ b/Tests/InterfaceBuildTargets/testlib.cxx @@ -0,0 +1,5 @@ + +void testlib(void) +{ + +} diff --git a/Tests/InterfaceLibrary/CMakeLists.txt b/Tests/InterfaceLibrary/CMakeLists.txt new file mode 100644 index 0000000..53aeb03 --- /dev/null +++ b/Tests/InterfaceLibrary/CMakeLists.txt @@ -0,0 +1,15 @@ + +cmake_minimum_required(VERSION 2.8) + +project(InterfaceLibrary) + +add_library(iface_nodepends INTERFACE) +target_compile_definitions(iface_nodepends INTERFACE IFACE_DEFINE) + +add_executable(InterfaceLibrary definetestexe.cpp) +target_link_libraries(InterfaceLibrary iface_nodepends) + +add_subdirectory(libsdir) + +add_executable(sharedlibtestexe sharedlibtestexe.cpp) +target_link_libraries(sharedlibtestexe shared_iface) diff --git a/Tests/InterfaceLibrary/definetestexe.cpp b/Tests/InterfaceLibrary/definetestexe.cpp new file mode 100644 index 0000000..decd37c --- /dev/null +++ b/Tests/InterfaceLibrary/definetestexe.cpp @@ -0,0 +1,9 @@ + +#ifndef IFACE_DEFINE +#error Expected IFACE_DEFINE +#endif + +int main(int,char**) +{ + return 0; +} diff --git a/Tests/InterfaceLibrary/libsdir/CMakeLists.txt b/Tests/InterfaceLibrary/libsdir/CMakeLists.txt new file mode 100644 index 0000000..6999646 --- /dev/null +++ b/Tests/InterfaceLibrary/libsdir/CMakeLists.txt @@ -0,0 +1,26 @@ + +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) 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/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/MakeClean/ToClean/CMakeLists.txt b/Tests/MakeClean/ToClean/CMakeLists.txt index 28569dd..37d7292 100644 --- a/Tests/MakeClean/ToClean/CMakeLists.txt +++ b/Tests/MakeClean/ToClean/CMakeLists.txt @@ -26,6 +26,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) 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/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/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..7991c4e 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,20 @@ 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_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 +) -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 +64,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..32d4c8d 100644 --- a/Tests/QtAutomoc/foo.h +++ b/Tests/QtAutogen/foo.h 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/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/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/CMP0022/CMP0022-NOWARN-static.cmake b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static.cmake index 3e4144f..ad3b8df 100644 --- a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static.cmake +++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static.cmake @@ -5,4 +5,8 @@ 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) -target_link_libraries(bar bat) +# 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 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..6d519f0 --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-stderr.txt @@ -0,0 +1,17 @@ +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. + + INTERFACE_LINK_LIBRARIES: + + foo + + LINK_INTERFACE_LIBRARIES: + + \(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..e41133a 100644 --- a/Tests/RunCMake/CMP0022/CMP0022-WARN-static-stderr.txt +++ b/Tests/RunCMake/CMP0022/CMP0022-WARN-static-stderr.txt @@ -7,4 +7,13 @@ CMake Warning \(dev\) in CMakeLists.txt: 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. + + 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-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..8e5824a 100644 --- a/Tests/RunCMake/CMP0022/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMP0022/RunCMakeTest.cmake @@ -3,6 +3,7 @@ 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-static) run_cmake(CMP0022-NOWARN-static-link_libraries) run_cmake(CMP0022-export) 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/Syntax/ParenNoSpace-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-IMPORTED-stderr.txt index 10f3293..10f3293 100644 --- a/Tests/RunCMake/Syntax/ParenNoSpace-stderr.txt +++ b/Tests/RunCMake/CMP0026/CMP0026-IMPORTED-stderr.txt 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/CMP0026/CMP0026-NEW-result.txt b/Tests/RunCMake/CMP0026/CMP0026-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0026/CMP0026-NEW-result.txt @@ -0,0 +1 @@ +1 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..a7b0799 --- /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 + a 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..2ff6927 --- /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 + a 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/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index e45aba3..99a0fb3 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -53,11 +53,16 @@ endif() add_RunCMake_test(CMP0019) add_RunCMake_test(CMP0022) +add_RunCMake_test(CMP0026) +add_RunCMake_test(CMP0027) +add_RunCMake_test(CMP0028) 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) @@ -89,17 +94,22 @@ add_RunCMake_test(Syntax) add_RunCMake_test(add_dependencies) add_RunCMake_test(build_command) +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(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 +129,4 @@ endif() add_RunCMake_test(File_Generate) add_RunCMake_test(ExportWithoutLanguage) add_RunCMake_test(target_link_libraries) +add_RunCMake_test(CheckModules) 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/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/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/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/RunCMakeTest.cmake b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake index 2dd8d38..42973f8 100644 --- a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake +++ b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake @@ -6,7 +6,6 @@ run_cmake(BadSourceExpression3) run_cmake(BadObjSource1) run_cmake(BadObjSource2) run_cmake(Export) -run_cmake(ExportLanguages) run_cmake(Import) run_cmake(Install) run_cmake(LinkObjLHS) 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/RunCMakeTest.cmake b/Tests/RunCMake/PositionIndependentCode/RunCMakeTest.cmake index 64a340c..3a2009b 100644 --- a/Tests/RunCMake/PositionIndependentCode/RunCMakeTest.cmake +++ b/Tests/RunCMake/PositionIndependentCode/RunCMakeTest.cmake @@ -3,3 +3,6 @@ include(RunCMake) run_cmake(Conflict1) run_cmake(Conflict2) run_cmake(Conflict3) +run_cmake(Conflict4) +run_cmake(Conflict5) +run_cmake(Conflict6) 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/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/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/RunCMakeTest.cmake b/Tests/RunCMake/include/RunCMakeTest.cmake index 59b87ca..7fc9a12 100644 --- a/Tests/RunCMake/include/RunCMakeTest.cmake +++ b/Tests/RunCMake/include/RunCMakeTest.cmake @@ -2,3 +2,5 @@ include(RunCMake) run_cmake(EmptyString) run_cmake(EmptyStringOptional) +run_cmake(CMP0024-WARN) +run_cmake(CMP0024-NEW) 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/RunCMakeTest.cmake b/Tests/RunCMake/include_directories/RunCMakeTest.cmake index f0704f4..f66823e 100644 --- a/Tests/RunCMake/include_directories/RunCMakeTest.cmake +++ b/Tests/RunCMake/include_directories/RunCMakeTest.cmake @@ -10,3 +10,4 @@ run_cmake(ImportedTarget) run_cmake(RelativePathInGenex) run_cmake(CMP0021) run_cmake(install_config) +run_cmake(incomplete-genex) 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/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..56caf68 --- /dev/null +++ b/Tests/RunCMake/interface_library/RunCMakeTest.cmake @@ -0,0 +1,4 @@ +include(RunCMake) + +run_cmake(invalid_name) +run_cmake(target_commands) 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/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/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/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/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) |