diff options
25 files changed, 303 insertions, 206 deletions
diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake index 829b6ff..dda28bd 100644 --- a/Modules/CMakeFindBinUtils.cmake +++ b/Modules/CMakeFindBinUtils.cmake @@ -66,9 +66,7 @@ else() endif() - -# on Apple there really should be install_name_tool -if(APPLE) +if(CMAKE_PLATFORM_HAS_INSTALLNAME) find_program(CMAKE_INSTALL_NAME_TOOL NAMES install_name_tool HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) if(NOT CMAKE_INSTALL_NAME_TOOL) diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index 66d300a..f00b577 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -363,6 +363,7 @@ function(GENERATE_EXPORT_HEADER TARGET_LIBRARY) get_property(type TARGET ${TARGET_LIBRARY} PROPERTY TYPE) if(NOT ${type} STREQUAL "STATIC_LIBRARY" AND NOT ${type} STREQUAL "SHARED_LIBRARY" + AND NOT ${type} STREQUAL "OBJECT_LIBRARY" AND NOT ${type} STREQUAL "MODULE_LIBRARY") message(WARNING "This macro can only be used with libraries") return() diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake index 593176c..86137e2 100644 --- a/Modules/WriteCompilerDetectionHeader.cmake +++ b/Modules/WriteCompilerDetectionHeader.cmake @@ -235,6 +235,14 @@ function(write_compiler_detection_header message(FATAL_ERROR "Unparsed arguments: ${_WCD_UNPARSED_ARGUMENTS}") endif() + if (prefix_arg STREQUAL "") + message(FATAL_ERROR "A prefix must be specified") + endif() + string(MAKE_C_IDENTIFIER ${prefix_arg} cleaned_prefix) + if (NOT prefix_arg STREQUAL cleaned_prefix) + message(FATAL_ERROR "The prefix must be a valid C identifier.") + endif() + if(NOT _WCD_VERSION) set(_WCD_VERSION ${CMAKE_MINIMUM_REQUIRED_VERSION}) endif() diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 27405be..8321e0a 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140702) +set(CMake_VERSION_PATCH 20140707) #set(CMake_VERSION_RC 1) diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 567acfc..f050148 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -317,6 +317,15 @@ int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg) return retVal; } +static void ctestScriptProgressCallback(const char *m, float, void* cd) +{ + cmCTest* ctest = static_cast<cmCTest*>(cd); + if(m && *m) + { + cmCTestLog(ctest, HANDLER_OUTPUT, "-- " << m << std::endl); + } +} + void cmCTestScriptHandler::CreateCMake() { // create a cmake instance to read the configuration script @@ -334,6 +343,8 @@ void cmCTestScriptHandler::CreateCMake() this->LocalGenerator = this->GlobalGenerator->CreateLocalGenerator(); this->Makefile = this->LocalGenerator->GetMakefile(); + this->CMake->SetProgressCallback(ctestScriptProgressCallback, this->CTest); + // Set CMAKE_CURRENT_SOURCE_DIR and CMAKE_CURRENT_BINARY_DIR. // Also, some commands need Makefile->GetCurrentDirectory(). std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index cb455e0..dc4f894 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1249,6 +1249,21 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set_tests_properties(ExternalProject PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT}) + add_test(ExternalProjectLocal ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/ExternalProjectLocal" + "${CMake_BINARY_DIR}/Tests/ExternalProjectLocal" + ${build_generator_args} + --build-project ExternalProjectLocalTest + --build-exe-dir "${CMake_BINARY_DIR}/Tests/ExternalProjectLocal" + --force-new-ctest-process + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProjectLocal") + set_tests_properties(ExternalProjectLocal PROPERTIES + TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT}) + add_test(ExternalProjectUpdateSetup ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/ExternalProjectUpdate" diff --git a/Tests/CTestTestTimeout/test.cmake.in b/Tests/CTestTestTimeout/test.cmake.in index 68c74d8..af53383 100644 --- a/Tests/CTestTestTimeout/test.cmake.in +++ b/Tests/CTestTestTimeout/test.cmake.in @@ -32,7 +32,7 @@ if(EXISTS "${log}") if(after_sleep) message(FATAL_ERROR "Log indicates timeout did not kill child.") else() - message("Log indicates timeout correctly killed child.") + message(STATUS "Log indicates timeout correctly killed child.") endif() else() message(FATAL_ERROR "Log does not exist:\n ${log}") diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt index 0ed5561..2f74121 100644 --- a/Tests/ExternalProject/CMakeLists.txt +++ b/Tests/ExternalProject/CMakeLists.txt @@ -3,6 +3,8 @@ project(ExternalProjectTest NONE) include(ExternalProject) +# Test ExternalProject, especially with checkouts from VCS + find_package(CVS) find_package(Subversion) find_package(Git) @@ -23,33 +25,6 @@ set(binary_base "${base}/Build") set_property(DIRECTORY PROPERTY EP_BASE ${base}) set_property(DIRECTORY PROPERTY EP_STEP_TARGETS configure build test) -if(NOT DEFINED can_build_tutorial_step5) - set(can_build_tutorial_step5 1) - - # Tutorial Step5 cannot build correctly using Visual Studio 6 - # on Windows 98 if the path of its build tree exceeds 72 - # characters in length... So don't attempt to build it - # in a long path on Win98: - # - if(CMAKE_SYSTEM STREQUAL "Windows-4.10") - string(LENGTH "${binary_base}/TutorialStep5-Local" n) - if(n GREATER 72) - set(can_build_tutorial_step5 0) - endif() - endif() - - # The ExternalProject builds of Tutorial Step5 cannot be built - # correctly 2nd and later times in an in-source build... - # (because the CMakeCache.txt from the real in-source build of - # the Tests/Tutorial/Step5 directory gets copied when we do - # the "source directory copy" step... but it still refers to - # its original path which yields a configure error.) So: - # - if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") - set(can_build_tutorial_step5 0) - endif() -endif() - add_custom_target(NonExternalProjectTarget COMMAND ${CMAKE_COMMAND} -E echo NonExternalProjectTarget) @@ -116,142 +91,6 @@ ExternalProject_Add(${proj} set_property(TARGET ${proj} PROPERTY FOLDER "") -# Local DIR: -# -if(can_build_tutorial_step5) - set(proj TutorialStep5-Local) - ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/../Tutorial/Step5" - CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> - CMAKE_ARGS -G ${CMAKE_GENERATOR} <SOURCE_DIR> - TEST_BEFORE_INSTALL 1 - LOG_INSTALL 1 - ) - set_property(TARGET ${proj} PROPERTY FOLDER "Local") - ExternalProject_Get_Property(${proj} install_dir) - set(TutorialStep5_install_dir ${install_dir}) - - set(proj TutorialStep5-Local-TestAfterInstall) - ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/../Tutorial/Step5" - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -G ${CMAKE_GENERATOR} <SOURCE_DIR> - TEST_AFTER_INSTALL 1 - LOG_TEST 1 - ) - set_property(TARGET ${proj} PROPERTY FOLDER "Local") -endif() - - -# Local TAR: -# -set(proj TutorialStep1-LocalTAR) -ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.tar" - URL_MD5 a87c5b47c0201c09ddfe1d5738fdb1e3 - LIST_SEPARATOR :: - PATCH_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/Step1Patch.cmake - CMAKE_GENERATOR "${CMAKE_GENERATOR}" - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> - -DTEST_LIST:STRING=A::B::C - INSTALL_COMMAND "" - LOG_CONFIGURE 1 -) -set_property(TARGET ${proj} PROPERTY FOLDER "Local/TAR") - -set(proj TutorialStep1-LocalNoDirTAR) -ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.tar" - URL_MD5 d09e3d370c5c908fa035c30939ee438e - LIST_SEPARATOR @@ - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -G ${CMAKE_GENERATOR} <SOURCE_DIR> - -DTEST_LIST:STRING=1@@2@@3 - INSTALL_COMMAND "" -) -set_property(TARGET ${proj} PROPERTY FOLDER "Local/TAR") -ExternalProject_Add_Step(${proj} mypatch - COMMAND ${CMAKE_COMMAND} -E echo "This is a custom external project step." - COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/Step1Patch.cmake - WORKING_DIRECTORY <SOURCE_DIR> - DEPENDEES download - DEPENDERS configure - ) - - -# Local TGZ: -# -set(proj TutorialStep1-LocalTGZ) -ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.tgz" - URL_MD5 38c648e817339c356f6be00eeed79bd0 - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -G ${CMAKE_GENERATOR} <SOURCE_DIR> - INSTALL_COMMAND "" - LOG_BUILD 1 -) -set_property(TARGET ${proj} PROPERTY FOLDER "Local/TGZ") - -set(proj TutorialStep1-LocalNoDirTGZ) -ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.tgz" - URL_HASH SHA256=496229e2a5ed620a37c385ad9406004a18026beab8b55dd2c4565d4b7f1d5383 - CMAKE_GENERATOR "${CMAKE_GENERATOR}" - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> - INSTALL_COMMAND "" -) -set_property(TARGET ${proj} PROPERTY FOLDER "Local/TGZ") - - -# Local BZ2: -# -# (The bz2 tests are here just to verify that the bz2 decompression is executed -# during a test suite run... The configure and build commands are set to -# nothing to make the test quicker. To make this more complete, I should add -# a diff between this and the TGZ source tree since that one does build...) -# -set(proj TutorialStep1-LocalBZ2) -ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.tar.bz2" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" -) -set_property(TARGET ${proj} PROPERTY FOLDER "Local/BZ2") - -set(proj TutorialStep1-LocalNoDirBZ2) -ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.tar.bz2" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" -) -set_property(TARGET ${proj} PROPERTY FOLDER "Local/BZ2") - - -# Local ZIP: -# -# (The zip tests are here just to verify that the zip decompression is executed -# during a test suite run... The configure and build commands are set to -# nothing to make the test quicker. To make this more complete, I should add -# a diff between this and the TGZ source tree since that one does build...) -# -set(proj TutorialStep1-LocalZIP) -ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.zip" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" -) -set_property(TARGET ${proj} PROPERTY FOLDER "Local/ZIP") - -set(proj TutorialStep1-LocalNoDirZIP) -ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.zip" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" -) -set_property(TARGET ${proj} PROPERTY FOLDER "Local/ZIP") - - # CVS-based tests: # set(do_cvs_tests 0) @@ -337,10 +176,6 @@ if(do_cvs_tests) INSTALL_COMMAND "" DEPENDS "SetupLocalCVSRepository" DEPENDS "EmptyNoOpProject" - DEPENDS "TutorialStep1-LocalTAR" - DEPENDS "TutorialStep1-LocalNoDirTAR" - DEPENDS "TutorialStep1-LocalTGZ" - DEPENDS "TutorialStep1-LocalNoDirTGZ" DEPENDS "TutorialStep1-CVS-20090626" DEPENDS "TutorialStep1-CVS-testtag1" ) @@ -612,29 +447,6 @@ enable_testing() # # BuildTree tests: # -if(can_build_tutorial_step5) - add_test(TutorialStep5-Local-BuildTreeTest - "${binary_base}/TutorialStep5-Local/Tutorial" 42) - set_property(TEST TutorialStep5-Local-BuildTreeTest - APPEND PROPERTY LABELS Step5 BuildTree) -endif() - -add_test(TutorialStep1-LocalTAR-BuildTreeTest - "${binary_base}/TutorialStep1-LocalTAR/EP-Tutorial" 36) -set_property(TEST TutorialStep1-LocalTAR-BuildTreeTest - APPEND PROPERTY LABELS TAR) - -add_test(TutorialStep1-LocalNoDirTAR-BuildTreeTest - "${binary_base}/TutorialStep1-LocalNoDirTAR/EP-Tutorial" 25) - -add_test(TutorialStep1-LocalTGZ-BuildTreeTest - "${binary_base}/TutorialStep1-LocalTGZ/Tutorial" 16) -set_property(TEST TutorialStep1-LocalTGZ-BuildTreeTest - APPEND PROPERTY LABELS TGZ) - -add_test(TutorialStep1-LocalNoDirTGZ-BuildTreeTest - "${binary_base}/TutorialStep1-LocalNoDirTGZ/Tutorial" 9) - if(do_cvs_tests) add_test(TutorialStep1-CVS-20090626-BuildTreeTest "${binary_base}/TutorialStep1-CVS-20090626/Tutorial" 4) @@ -669,17 +481,6 @@ if(do_git_tests) endif() -# InstallTree tests: -# -if(can_build_tutorial_step5) - add_test(TutorialStep5-InstallTreeTest - "${TutorialStep5_install_dir}/bin/Tutorial" 49) - set_property(TEST TutorialStep5-InstallTreeTest - APPEND PROPERTY LABELS Step5 InstallTree) -endif() - - -message(STATUS "can_build_tutorial_step5='${can_build_tutorial_step5}'") message(STATUS "do_cvs_tests='${do_cvs_tests}'") message(STATUS "do_svn_tests='${do_svn_tests}'") message(STATUS "do_git_tests='${do_git_tests}' GIT_EXECUTABLE='${GIT_EXECUTABLE}'") diff --git a/Tests/ExternalProjectLocal/CMakeLists.txt b/Tests/ExternalProjectLocal/CMakeLists.txt new file mode 100644 index 0000000..f942197 --- /dev/null +++ b/Tests/ExternalProjectLocal/CMakeLists.txt @@ -0,0 +1,229 @@ +cmake_minimum_required(VERSION 2.8) +project(ExternalProjectLocalTest NONE) + +include(ExternalProject) + +# Test ExternalProject with local projects + +option(ExternalProjectTest_USE_FOLDERS "Enable folder grouping in IDEs." ON) +if(ExternalProjectTest_USE_FOLDERS) + set_property(GLOBAL PROPERTY USE_FOLDERS ON) +else() + set_property(GLOBAL PROPERTY USE_FOLDERS OFF) +endif() + +set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER + "CMakePredefinedTargets-in-ExternalProjectTest") + +set(base "${CMAKE_BINARY_DIR}/CMakeExternals") +set(binary_base "${base}/Build") +set_property(DIRECTORY PROPERTY EP_BASE ${base}) +set_property(DIRECTORY PROPERTY EP_STEP_TARGETS configure build test) + +if(NOT DEFINED can_build_tutorial_step5) + set(can_build_tutorial_step5 1) + + # Tutorial Step5 cannot build correctly using Visual Studio 6 + # on Windows 98 if the path of its build tree exceeds 72 + # characters in length... So don't attempt to build it + # in a long path on Win98: + # + if(CMAKE_SYSTEM STREQUAL "Windows-4.10") + string(LENGTH "${binary_base}/TutorialStep5-Local" n) + if(n GREATER 72) + set(can_build_tutorial_step5 0) + endif() + endif() + + # The ExternalProject builds of Tutorial Step5 cannot be built + # correctly 2nd and later times in an in-source build... + # (because the CMakeCache.txt from the real in-source build of + # the Tests/Tutorial/Step5 directory gets copied when we do + # the "source directory copy" step... but it still refers to + # its original path which yields a configure error.) So: + # + if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") + set(can_build_tutorial_step5 0) + endif() +endif() + +# Local DIR: +# +if(can_build_tutorial_step5) + set(proj TutorialStep5-Local) + ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/../Tutorial/Step5" + CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> + CMAKE_ARGS -G ${CMAKE_GENERATOR} <SOURCE_DIR> + TEST_BEFORE_INSTALL 1 + LOG_INSTALL 1 + ) + set_property(TARGET ${proj} PROPERTY FOLDER "Local") + ExternalProject_Get_Property(${proj} install_dir) + set(TutorialStep5_install_dir ${install_dir}) + + set(proj TutorialStep5-Local-TestAfterInstall) + ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/../Tutorial/Step5" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -G ${CMAKE_GENERATOR} <SOURCE_DIR> + TEST_AFTER_INSTALL 1 + LOG_TEST 1 + ) + set_property(TARGET ${proj} PROPERTY FOLDER "Local") +endif() + + +# Local TAR: +# +set(proj TutorialStep1-LocalTAR) +ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.tar" + URL_MD5 a87c5b47c0201c09ddfe1d5738fdb1e3 + LIST_SEPARATOR :: + PATCH_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/Step1Patch.cmake + CMAKE_GENERATOR "${CMAKE_GENERATOR}" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> + -DTEST_LIST:STRING=A::B::C + INSTALL_COMMAND "" + LOG_CONFIGURE 1 +) +set_property(TARGET ${proj} PROPERTY FOLDER "Local/TAR") + +set(proj TutorialStep1-LocalNoDirTAR) +ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.tar" + URL_MD5 d09e3d370c5c908fa035c30939ee438e + LIST_SEPARATOR @@ + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -G ${CMAKE_GENERATOR} <SOURCE_DIR> + -DTEST_LIST:STRING=1@@2@@3 + INSTALL_COMMAND "" +) +set_property(TARGET ${proj} PROPERTY FOLDER "Local/TAR") +ExternalProject_Add_Step(${proj} mypatch + COMMAND ${CMAKE_COMMAND} -E echo "This is a custom external project step." + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/Step1Patch.cmake + WORKING_DIRECTORY <SOURCE_DIR> + DEPENDEES download + DEPENDERS configure + ) + + +# Local TGZ: +# +set(proj TutorialStep1-LocalTGZ) +ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.tgz" + URL_MD5 38c648e817339c356f6be00eeed79bd0 + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -G ${CMAKE_GENERATOR} <SOURCE_DIR> + INSTALL_COMMAND "" + LOG_BUILD 1 +) +set_property(TARGET ${proj} PROPERTY FOLDER "Local/TGZ") + +set(proj TutorialStep1-LocalNoDirTGZ) +ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.tgz" + URL_HASH SHA256=496229e2a5ed620a37c385ad9406004a18026beab8b55dd2c4565d4b7f1d5383 + CMAKE_GENERATOR "${CMAKE_GENERATOR}" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> + INSTALL_COMMAND "" +) +set_property(TARGET ${proj} PROPERTY FOLDER "Local/TGZ") + + +# Local BZ2: +# +# (The bz2 tests are here just to verify that the bz2 decompression is executed +# during a test suite run... The configure and build commands are set to +# nothing to make the test quicker. To make this more complete, I should add +# a diff between this and the TGZ source tree since that one does build...) +# +set(proj TutorialStep1-LocalBZ2) +ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.tar.bz2" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" +) +set_property(TARGET ${proj} PROPERTY FOLDER "Local/BZ2") + +set(proj TutorialStep1-LocalNoDirBZ2) +ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.tar.bz2" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" +) +set_property(TARGET ${proj} PROPERTY FOLDER "Local/BZ2") + + +# Local ZIP: +# +# (The zip tests are here just to verify that the zip decompression is executed +# during a test suite run... The configure and build commands are set to +# nothing to make the test quicker. To make this more complete, I should add +# a diff between this and the TGZ source tree since that one does build...) +# +set(proj TutorialStep1-LocalZIP) +ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.zip" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" +) +set_property(TARGET ${proj} PROPERTY FOLDER "Local/ZIP") + +set(proj TutorialStep1-LocalNoDirZIP) +ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.zip" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" +) +set_property(TARGET ${proj} PROPERTY FOLDER "Local/ZIP") + + +# Test the testable built/installed products: +# +enable_testing() + + +# Do at least a smoke test of a built executable from each +# project's build directory... +# +# BuildTree tests: +# +if(can_build_tutorial_step5) + add_test(TutorialStep5-Local-BuildTreeTest + "${binary_base}/TutorialStep5-Local/Tutorial" 42) + set_property(TEST TutorialStep5-Local-BuildTreeTest + APPEND PROPERTY LABELS Step5 BuildTree) +endif() + +add_test(TutorialStep1-LocalTAR-BuildTreeTest + "${binary_base}/TutorialStep1-LocalTAR/EP-Tutorial" 36) +set_property(TEST TutorialStep1-LocalTAR-BuildTreeTest + APPEND PROPERTY LABELS TAR) + +add_test(TutorialStep1-LocalNoDirTAR-BuildTreeTest + "${binary_base}/TutorialStep1-LocalNoDirTAR/EP-Tutorial" 25) + +add_test(TutorialStep1-LocalTGZ-BuildTreeTest + "${binary_base}/TutorialStep1-LocalTGZ/Tutorial" 16) +set_property(TEST TutorialStep1-LocalTGZ-BuildTreeTest + APPEND PROPERTY LABELS TGZ) + +add_test(TutorialStep1-LocalNoDirTGZ-BuildTreeTest + "${binary_base}/TutorialStep1-LocalNoDirTGZ/Tutorial" 9) + +# InstallTree tests: +# +if(can_build_tutorial_step5) + add_test(TutorialStep5-InstallTreeTest + "${TutorialStep5_install_dir}/bin/Tutorial" 49) + set_property(TEST TutorialStep5-InstallTreeTest + APPEND PROPERTY LABELS Step5 InstallTree) +endif() + + +message(STATUS "can_build_tutorial_step5='${can_build_tutorial_step5}'") diff --git a/Tests/ExternalProject/Step1.tar b/Tests/ExternalProjectLocal/Step1.tar Binary files differindex 3711f07..3711f07 100644 --- a/Tests/ExternalProject/Step1.tar +++ b/Tests/ExternalProjectLocal/Step1.tar diff --git a/Tests/ExternalProject/Step1.tar.bz2 b/Tests/ExternalProjectLocal/Step1.tar.bz2 Binary files differindex 49b5f23..49b5f23 100644 --- a/Tests/ExternalProject/Step1.tar.bz2 +++ b/Tests/ExternalProjectLocal/Step1.tar.bz2 diff --git a/Tests/ExternalProject/Step1.tgz b/Tests/ExternalProjectLocal/Step1.tgz Binary files differindex d9b4cd2..d9b4cd2 100644 --- a/Tests/ExternalProject/Step1.tgz +++ b/Tests/ExternalProjectLocal/Step1.tgz diff --git a/Tests/ExternalProject/Step1.zip b/Tests/ExternalProjectLocal/Step1.zip Binary files differindex 49dac24..49dac24 100644 --- a/Tests/ExternalProject/Step1.zip +++ b/Tests/ExternalProjectLocal/Step1.zip diff --git a/Tests/ExternalProject/Step1NoDir.tar b/Tests/ExternalProjectLocal/Step1NoDir.tar Binary files differindex 03664b8..03664b8 100644 --- a/Tests/ExternalProject/Step1NoDir.tar +++ b/Tests/ExternalProjectLocal/Step1NoDir.tar diff --git a/Tests/ExternalProject/Step1NoDir.tar.bz2 b/Tests/ExternalProjectLocal/Step1NoDir.tar.bz2 Binary files differindex 92eb480..92eb480 100644 --- a/Tests/ExternalProject/Step1NoDir.tar.bz2 +++ b/Tests/ExternalProjectLocal/Step1NoDir.tar.bz2 diff --git a/Tests/ExternalProject/Step1NoDir.tgz b/Tests/ExternalProjectLocal/Step1NoDir.tgz Binary files differindex 71a2d81..71a2d81 100644 --- a/Tests/ExternalProject/Step1NoDir.tgz +++ b/Tests/ExternalProjectLocal/Step1NoDir.tgz diff --git a/Tests/ExternalProject/Step1NoDir.zip b/Tests/ExternalProjectLocal/Step1NoDir.zip Binary files differindex b42d318..b42d318 100644 --- a/Tests/ExternalProject/Step1NoDir.zip +++ b/Tests/ExternalProjectLocal/Step1NoDir.zip diff --git a/Tests/ExternalProject/Step1Patch.cmake b/Tests/ExternalProjectLocal/Step1Patch.cmake index 35e09d9..35e09d9 100644 --- a/Tests/ExternalProject/Step1Patch.cmake +++ b/Tests/ExternalProjectLocal/Step1Patch.cmake diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix-result.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix-stderr.txt new file mode 100644 index 0000000..cf8578e --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at .*/Modules/WriteCompilerDetectionHeader.cmake:[0-9]+ \(message\): + A prefix must be specified +Call Stack \(most recent call first\): + EmptyPrefix.cmake:[0-9]+ \(write_compiler_detection_header\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix.cmake new file mode 100644 index 0000000..eda6b18 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix.cmake @@ -0,0 +1,10 @@ + +include(WriteCompilerDetectionHeader) + +write_compiler_detection_header( + FILE "${CMAKE_CURRENT_BINARY_DIR}/somefile" + PREFIX "" + VERSION 3.1 + COMPILERS GNU + FEATURES cxx_final +) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix-result.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix-stderr.txt new file mode 100644 index 0000000..ea1bf67 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at .*/Modules/WriteCompilerDetectionHeader.cmake:[0-9]+ \(message\): + The prefix must be a valid C identifier. +Call Stack \(most recent call first\): + InvalidPrefix.cmake:[0-9]+ \(write_compiler_detection_header\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix.cmake new file mode 100644 index 0000000..6599f35 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix.cmake @@ -0,0 +1,10 @@ + +include(WriteCompilerDetectionHeader) + +write_compiler_detection_header( + FILE "${CMAKE_CURRENT_BINARY_DIR}/somefile" + PREFIX "0compile" + VERSION 3.1 + COMPILERS GNU + FEATURES cxx_final +) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/RunCMakeTest.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/RunCMakeTest.cmake index be79d41..6dded44 100644 --- a/Tests/RunCMake/WriteCompilerDetectionHeader/RunCMakeTest.cmake +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/RunCMakeTest.cmake @@ -10,3 +10,5 @@ run_cmake(OldVersion) run_cmake(InvalidCompiler) run_cmake(InvalidFeature) run_cmake(InvalidCXXFeature) +run_cmake(EmptyPrefix) +run_cmake(InvalidPrefix) |