diff options
27 files changed, 191 insertions, 91 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 51a1d8bc0..e60b6c568 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -511,7 +511,7 @@ macro (CMAKE_BUILD_UTILITIES) #--------------------------------------------------------------------- # Build or use system libarchive for CMake and CTest. if(CMAKE_USE_SYSTEM_LIBARCHIVE) - find_package(LibArchive 3.1.0) + find_package(LibArchive 3.3.3) if(NOT LibArchive_FOUND) message(FATAL_ERROR "CMAKE_USE_SYSTEM_LIBARCHIVE is ON but LibArchive is not found!") endif() diff --git a/Help/release/3.15.rst b/Help/release/3.15.rst index b0365bac2..48f3aa4fb 100644 --- a/Help/release/3.15.rst +++ b/Help/release/3.15.rst @@ -369,3 +369,10 @@ Changes made since CMake 3.15.0 include the following. * In CMake 3.15.0 and 3.15.1 the :variable:`CMAKE_FIND_PACKAGE_PREFER_CONFIG` variable caused the :command:`find_package` command to fail on a missing package even without the ``REQUIRED`` option. This has been fixed. + +3.15.3 +------ + +* ``CrayPrgEnv`` compiler wrapper support has been updated for the 19.06 + release of the Cray Programming Environment for which the default linking + mode on XC Cray systems is now dynamic instead of static. diff --git a/Modules/Compiler/CrayPrgEnv.cmake b/Modules/Compiler/CrayPrgEnv.cmake index e55e5873a..f6e46acaa 100644 --- a/Modules/Compiler/CrayPrgEnv.cmake +++ b/Modules/Compiler/CrayPrgEnv.cmake @@ -69,13 +69,27 @@ endfunction() # note that cmake applies both CMAKE_${lang}_FLAGS and CMAKE_EXE_LINKER_FLAGS # (in that order) to the linking command, so -dynamic can appear in either # variable. +# +# Note: As of CrayPE v19.06 (which translates to the craype/2.6.0 module) +# the default has changed and is now dynamic by default. This is handled +# accordingly function(__cmake_craype_linktype lang rv) # start with ENV, but allow flags to override - if("$ENV{CRAYPE_LINK_TYPE}" STREQUAL "dynamic") - set(linktype dynamic) + if(("$ENV{CRAYPE_VERSION}" STREQUAL "") OR + ("$ENV{CRAYPE_VERSION}" VERSION_LESS "2.6")) + if("$ENV{CRAYPE_LINK_TYPE}" STREQUAL "dynamic") + set(linktype dynamic) + else() + set(linktype static) + endif() else() - set(linktype static) + if("$ENV{CRAYPE_LINK_TYPE}" STREQUAL "static") + set(linktype static) + else() + set(linktype dynamic) + endif() endif() + # combine flags and convert to a list so we can apply the flags in order set(linkflags "${CMAKE_${lang}_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}") string(REPLACE " " ";" linkflags "${linkflags}") diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 25dd397cf..078000f22 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -266,6 +266,21 @@ function(_boost_get_existing_target component target_var) foreach(prefix Boost boost) foreach(name IN LISTS names) if(TARGET "${prefix}::${name}") + # The target may be an INTERFACE library that wraps around a single other + # target for compatibility. Unwrap this layer so we can extract real info. + if("${name}" MATCHES "^(python|numpy|mpi_python)([1-9])([0-9])$") + set(name_nv "${CMAKE_MATCH_1}") + if(TARGET "${prefix}::${name_nv}") + get_property(type TARGET "${prefix}::${name}" PROPERTY TYPE) + if(type STREQUAL "INTERFACE_LIBRARY") + get_property(lib TARGET "${prefix}::${name}" PROPERTY INTERFACE_LINK_LIBRARIES) + if("${lib}" STREQUAL "${prefix}::${name_nv}") + set(${target_var} "${prefix}::${name_nv}" PARENT_SCOPE) + return() + endif() + endif() + endif() + endif() set(${target_var} "${prefix}::${name}" PARENT_SCOPE) return() endif() @@ -330,7 +345,7 @@ function(_boost_set_legacy_variables_from_config) _boost_get_existing_target(${comp} target) if(NOT target) if(Boost_DEBUG OR Boost_VERBOSE) - message(WARNING "Could not find imported target for required component '${comp}'. Standard variables for this component might be missing. Refer to the documentation of your Boost installation for help on variables to use.") + message(WARNING "Could not find imported target for required component '${comp}'. Legacy variables for this component might be missing. Refer to the documentation of your Boost installation for help on variables to use.") endif() continue() endif() @@ -338,14 +353,20 @@ function(_boost_set_legacy_variables_from_config) _boost_set_if_unset(Boost_${uppercomp}_LIBRARY "${target}") _boost_set_if_unset(Boost_${uppercomp}_LIBRARIES "${target}") # Very old legacy variable list(APPEND libraries "${target}") - foreach(cfg RELEASE DEBUG) - get_target_property(lib ${target} IMPORTED_LOCATION_${cfg}) - if(lib) - get_filename_component(lib_dir "${lib}" DIRECTORY) - list(APPEND library_dirs ${lib_dir}) - _boost_set_cache_if_unset(Boost_${uppercomp}_LIBRARY_${cfg} "${lib}") - endif() - endforeach() + get_property(type TARGET "${target}" PROPERTY TYPE) + if(NOT type STREQUAL "INTERFACE_LIBRARY") + foreach(cfg RELEASE DEBUG) + get_target_property(lib ${target} IMPORTED_LOCATION_${cfg}) + if(lib) + get_filename_component(lib_dir "${lib}" DIRECTORY) + list(APPEND library_dirs ${lib_dir}) + _boost_set_cache_if_unset(Boost_${uppercomp}_LIBRARY_${cfg} "${lib}") + endif() + endforeach() + elseif(Boost_DEBUG OR Boost_VERBOSE) + # For projects using only the Boost::* targets this warning can be safely ignored. + message(WARNING "Imported target '${target}' for required component '${comp}' has no artifact. Legacy variables for this component might be missing. Refer to the documentation of your Boost installation for help on variables to use.") + endif() _boost_get_canonical_target_name("${comp}" canonical_target) if(NOT TARGET "${canonical_target}") add_library("${canonical_target}" INTERFACE IMPORTED) @@ -1105,23 +1126,21 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_TIMER_DEPENDENCIES chrono system) set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - else() - if(NOT Boost_VERSION_STRING VERSION_LESS 1.70.0) - set(_Boost_CONTRACT_DEPENDENCIES thread chrono date_time) - set(_Boost_COROUTINE_DEPENDENCIES context) - set(_Boost_FIBER_DEPENDENCIES context) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES date_time log_setup filesystem thread regex chrono atomic) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) - set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) - set(_Boost_THREAD_DEPENDENCIES chrono date_time atomic) - set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - endif() - if(NOT Boost_VERSION_STRING VERSION_LESS 1.71.0) + elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.70.0) + set(_Boost_CONTRACT_DEPENDENCIES thread chrono date_time) + set(_Boost_COROUTINE_DEPENDENCIES context) + set(_Boost_FIBER_DEPENDENCIES context) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES date_time log_setup filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) + set(_Boost_THREAD_DEPENDENCIES chrono date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono) + set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + if(NOT Boost_VERSION_STRING VERSION_LESS 1.72.0) message(WARNING "New Boost version may have incorrect or missing dependencies and imported targets") endif() endif() @@ -1393,7 +1412,7 @@ else() # _Boost_COMPONENT_HEADERS. See the instructions at the top of # _Boost_COMPONENT_DEPENDENCIES. set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} - "1.70.0" "1.70" "1.69.0" "1.69" + "1.71.0" "1.71" "1.70.0" "1.70" "1.69.0" "1.69" "1.68.0" "1.68" "1.67.0" "1.67" "1.66.0" "1.66" "1.65.1" "1.65.0" "1.65" "1.64.0" "1.64" "1.63.0" "1.63" "1.62.0" "1.62" "1.61.0" "1.61" "1.60.0" "1.60" "1.59.0" "1.59" "1.58.0" "1.58" "1.57.0" "1.57" "1.56.0" "1.56" "1.55.0" "1.55" diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index 9471be8b2..2b9b20cb1 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -1698,7 +1698,7 @@ foreach(LANG IN ITEMS C CXX Fortran) set(MPI_${LANG}_INCLUDE_PATH "${MPI_${LANG}_INCLUDE_DIRS}") unset(MPI_${LANG}_COMPILE_FLAGS) if(MPI_${LANG}_COMPILE_OPTIONS) - list(JOIN MPI_${LANG}_COMPILE_FLAGS " " MPI_${LANG}_COMPILE_OPTIONS) + list(JOIN MPI_${LANG}_COMPILE_OPTIONS " " MPI_${LANG}_COMPILE_FLAGS) endif() if(MPI_${LANG}_COMPILE_DEFINITIONS) foreach(_MPI_DEF IN LISTS MPI_${LANG}_COMPILE_DEFINITIONS) diff --git a/Modules/Platform/Windows-Flang-Fortran.cmake b/Modules/Platform/Windows-Flang-Fortran.cmake index a4b1cf14e..c4420f7cd 100644 --- a/Modules/Platform/Windows-Flang-Fortran.cmake +++ b/Modules/Platform/Windows-Flang-Fortran.cmake @@ -1,3 +1,8 @@ include(Platform/Windows-MSVC) __windows_compiler_msvc(Fortran) set(CMAKE_Fortran_COMPILE_OBJECT "<CMAKE_Fortran_COMPILER> ${_COMPILE_Fortran} <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>") + +set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded -Xclang --dependent-lib=libcmt) +set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL -Xclang --dependent-lib=msvcrt) +set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug -Xclang --dependent-lib=libcmtd) +set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL -Xclang --dependent-lib=msvcrtd) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index efbbeb438..72e6f4eca 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 15) -set(CMake_VERSION_PATCH 2) +set(CMake_VERSION_PATCH 3) #set(CMake_VERSION_RC 0) diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index ef63073b1..1b71f2ab6 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -855,8 +855,8 @@ static Json::Value DumpCTestProperties( DumpCTestProperty("PROCESSORS", testProperties.Processors)); } if (!testProperties.RequiredFiles.empty()) { - properties["REQUIRED_FILES"] = - DumpToJsonArray(testProperties.RequiredFiles); + properties.append(DumpCTestProperty( + "REQUIRED_FILES", DumpToJsonArray(testProperties.RequiredFiles))); } if (!testProperties.LockedResources.empty()) { properties.append(DumpCTestProperty( diff --git a/Source/CursesDialog/cmCursesOptionsWidget.cxx b/Source/CursesDialog/cmCursesOptionsWidget.cxx index a8c493380..eb773ad0f 100644 --- a/Source/CursesDialog/cmCursesOptionsWidget.cxx +++ b/Source/CursesDialog/cmCursesOptionsWidget.cxx @@ -23,6 +23,9 @@ cmCursesOptionsWidget::cmCursesOptionsWidget(int width, int height, int left, bool cmCursesOptionsWidget::HandleInput(int& key, cmCursesMainForm* /*fm*/, WINDOW* w) { + if (this->Options.empty()) { + return false; + } switch (key) { case 10: // 10 == enter case KEY_ENTER: diff --git a/Source/cmAffinity.cxx b/Source/cmAffinity.cxx index 588b2f2f5..09b029866 100644 --- a/Source/cmAffinity.cxx +++ b/Source/cmAffinity.cxx @@ -12,6 +12,8 @@ # define CM_HAVE_CPU_AFFINITY # include <pthread.h> # include <sched.h> +// On some platforms CPU_ZERO needs memset but sched.h forgets string.h +# include <string.h> // IWYU pragma: keep # if defined(__FreeBSD__) # include <pthread_np.h> # include <sys/cpuset.h> diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx index 6025025b0..fecbf63ca 100644 --- a/Source/cmFileAPICodemodel.cxx +++ b/Source/cmFileAPICodemodel.cxx @@ -502,6 +502,12 @@ Json::Value CodemodelConfig::DumpTarget(cmGeneratorTarget* gt, { Target t(gt, this->Config); std::string prefix = "target-" + gt->GetName(); + for (char& c : prefix) { + // CMP0037 OLD behavior allows slashes in target names. Remove them. + if (c == '/' || c == '\\') { + c = '_'; + } + } if (!this->Config.empty()) { prefix += "-" + this->Config; } diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index e5908028f..42aff0438 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -141,7 +141,7 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn) // look for old style // FIND_*(VAR name path1 path2 ...) - if (!newStyle) { + if (!newStyle && !this->Names.empty()) { // All the short-hand arguments have been recorded as names. std::vector<std::string> shortArgs = this->Names; this->Names.clear(); // clear out any values in Names diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 9afc15a6d..6b001f2d5 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -924,12 +924,9 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility( cmMakefile* mf, std::string const& lang) const { std::string compilerIdVar = "CMAKE_" + lang + "_COMPILER_ID"; - const char* compilerId = mf->GetDefinition(compilerIdVar); - if (!compilerId) { - return; - } + std::string const compilerId = mf->GetSafeDefinition(compilerIdVar); - if (strcmp(compilerId, "AppleClang") == 0) { + if (compilerId == "AppleClang") { switch (mf->GetPolicyStatus(cmPolicies::CMP0025)) { case cmPolicies::WARN: if (!this->CMakeInstance->GetIsInTryCompile() && @@ -959,7 +956,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility( } } - if (strcmp(compilerId, "QCC") == 0) { + if (compilerId == "QCC") { switch (mf->GetPolicyStatus(cmPolicies::CMP0047)) { case cmPolicies::WARN: if (!this->CMakeInstance->GetIsInTryCompile() && @@ -995,7 +992,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility( } } - if (strcmp(compilerId, "XLClang") == 0) { + if (compilerId == "XLClang") { switch (mf->GetPolicyStatus(cmPolicies::CMP0089)) { case cmPolicies::WARN: if (!this->CMakeInstance->GetIsInTryCompile() && diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index f65abc839..b7b822ab1 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -85,6 +85,7 @@ void cmNinjaNormalTargetGenerator::Generate() this->WriteLinkStatement(); } + // Find ADDITIONAL_CLEAN_FILES this->AdditionalCleanFiles(); } diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx index 1225cbdf3..e774b53b5 100644 --- a/Source/cmNinjaUtilityTargetGenerator.cxx +++ b/Source/cmNinjaUtilityTargetGenerator.cxx @@ -135,6 +135,9 @@ void cmNinjaUtilityTargetGenerator::Generate() gg->WriteBuild(this->GetBuildFileStream(), phonyBuild); } + // Find ADDITIONAL_CLEAN_FILES + this->AdditionalCleanFiles(); + // Add an alias for the logical target name regardless of what directory // contains it. Skip this for GLOBAL_TARGET because they are meant to // be per-directory and have one at the top-level anyway. diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx index 889f47db1..641d8aa3f 100644 --- a/Source/cmQtAutoMocUic.cxx +++ b/Source/cmQtAutoMocUic.cxx @@ -982,7 +982,7 @@ bool cmQtAutoMocUic::JobEvaluateT::UicEval(SourceFileMapT const& fileMap) } bool cmQtAutoMocUic::JobEvaluateT::UicEvalFile( - SourceFileHandleT sourceFileHandle) + SourceFileHandleT const& sourceFileHandle) { SourceFileT const& sourceFile = *sourceFileHandle; auto const& Include = sourceFile.ParseData->Uic.Include; @@ -1000,7 +1000,7 @@ bool cmQtAutoMocUic::JobEvaluateT::UicEvalFile( } // Register mapping if (!UicRegisterMapping(incKey.Key, std::move(uiFileHandle), - std::move(sourceFileHandle))) { + sourceFileHandle)) { return false; } } diff --git a/Source/cmQtAutoMocUic.h b/Source/cmQtAutoMocUic.h index 8061c13e6..81546cc18 100644 --- a/Source/cmQtAutoMocUic.h +++ b/Source/cmQtAutoMocUic.h @@ -439,7 +439,7 @@ public: // -- Uic bool UicEval(SourceFileMapT const& fileMap); - bool UicEvalFile(SourceFileHandleT sourceFileHandle); + bool UicEvalFile(SourceFileHandleT const& sourceFileHandle); SourceFileHandleT UicFindIncludedUi(std::string const& sourceFile, std::string const& sourceDir, IncludeKeyT const& incKey) const; diff --git a/Tests/MSVCRuntimeLibrary/Fortran/CMakeLists.txt b/Tests/MSVCRuntimeLibrary/Fortran/CMakeLists.txt index 169ba07d3..27838a40a 100644 --- a/Tests/MSVCRuntimeLibrary/Fortran/CMakeLists.txt +++ b/Tests/MSVCRuntimeLibrary/Fortran/CMakeLists.txt @@ -6,9 +6,17 @@ foreach(t MultiThreaded SingleThreaded) foreach(dbg "" Debug) foreach(dll "" DLL) set(var "CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_${t}${dbg}${dll}") - # ifort does not actually define these, so inject them - string(REPLACE "-threads" "-threads;-D_MT" "${var}" "${${var}}") - string(REPLACE "-dbglibs" "-dbglibs;-D_DEBUG" "${var}" "${${var}}") + if(CMAKE_Fortran_COMPILER_ID STREQUAL "Intel") + # ifort does not actually define these, so inject them + string(REPLACE "-threads" "-threads;-D_MT" "${var}" "${${var}}") + string(REPLACE "-dbglibs" "-dbglibs;-D_DEBUG" "${var}" "${${var}}") + elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "Flang") + # flang does not actually define these, so inject them + string(REPLACE ";--dependent-lib=libcmt;" ";--dependent-lib=libcmt;-D_MT;" "${var}" ";${${var}};") + string(REPLACE ";--dependent-lib=msvcrt;" ";--dependent-lib=msvcrt;-D_MT;-D_DLL;" "${var}" ";${${var}};") + string(REPLACE ";--dependent-lib=libcmtd;" ";--dependent-lib=libcmtd;-D_MT;-D_DEBUG;" "${var}" ";${${var}};") + string(REPLACE ";--dependent-lib=msvcrtd;" ";--dependent-lib=msvcrtd;-D_MT;-D_DEBUG;-D_DLL;" "${var}" ";${${var}};") + endif() endforeach() endforeach() endforeach() @@ -45,6 +53,6 @@ endfunction() verify(Fortran verify.F90) # Intel Fortran for Windows supports single-threaded RTL but it is # not implemented by the Visual Studio integration. -if(NOT CMAKE_GENERATOR MATCHES "Visual Studio") +if(CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" AND NOT CMAKE_GENERATOR MATCHES "Visual Studio") verify_combinations(SingleThreaded Fortran verify.F90) endif() diff --git a/Tests/MakeClean/ToClean/CMakeLists.txt b/Tests/MakeClean/ToClean/CMakeLists.txt index 6f16d129f..a05c38b22 100644 --- a/Tests/MakeClean/ToClean/CMakeLists.txt +++ b/Tests/MakeClean/ToClean/CMakeLists.txt @@ -15,42 +15,45 @@ function(writeCleanFile FILENAME) file(WRITE "${FILENAME}" ${CLEAN_FILE_CONTENT}) endfunction() +set(DUMMY_CONTENT_FILE ${CSD}/toclean.cxx) + # Build a simple project whose compiled objects should be cleaned. add_executable(toclean toclean.cxx) -addCleanFile("${CBD}${CMAKE_FILES_DIRECTORY}/toclean.dir/toclean.cxx${CMAKE_CXX_OUTPUT_EXTENSION}") +addCleanFile( + "${CBD}${CMAKE_FILES_DIRECTORY}/toclean.dir/toclean.cxx${CMAKE_CXX_OUTPUT_EXTENSION}") -# Create a post build custom command that copies the toclean output executable +# Create a post build custom command that copies a dummy file # to a custom location -function(addToCleanPostBuildCopy FILENAME) - add_custom_command(TARGET toclean POST_BUILD +function(addPostBuildFile TARGET FILENAME) + add_custom_command(TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy $<TARGET_FILE:toclean> ${FILENAME}) + ARGS -E copy ${DUMMY_CONTENT_FILE} ${FILENAME}) endfunction() # Create a custom command whose output should be cleaned. set(CustomCommandFile "${CBD}/CustomCommandFile.txt") add_custom_command(OUTPUT ${CustomCommandFile} - DEPENDS ${CSD}/toclean.cxx + DEPENDS ${DUMMY_CONTENT_FILE} COMMAND ${CMAKE_COMMAND} - ARGS -E copy ${CSD}/toclean.cxx ${CustomCommandFile}) -add_custom_target(generate ALL DEPENDS ${CustomCommandFile}) + ARGS -E copy ${DUMMY_CONTENT_FILE} ${CustomCommandFile}) +add_custom_target(customTarget ALL DEPENDS ${CustomCommandFile}) addCleanFile(${CustomCommandFile}) ### Tests ADDITIONAL_MAKE_CLEAN_FILES directory property if("${CMAKE_GENERATOR}" MATCHES "Makefile") # Create a file that must be registered for cleaning. - set(MakeDirPropFile "${CBD}/MakeDirPropFile.txt") - writeCleanFile("${MakeDirPropFile}") - set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${MakeDirPropFile}") - addCleanFile(${MakeDirPropFile}) + set(MakeDirPropFileAbs "${CBD}/MakeDirPropFile.txt") + writeCleanFile("${MakeDirPropFileAbs}") + set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${MakeDirPropFileAbs}") + addCleanFile(${MakeDirPropFileAbs}) # Create a custom command whose output should be cleaned, but whose name # is not known until generate-time set(MakeDirPropExpFileRel "MakeDirProp_copy${CMAKE_EXECUTABLE_SUFFIX}") - set(MakeDirPropExpFile "$<TARGET_FILE_DIR:toclean>/${MakeDirPropExpFileRel}") - addToCleanPostBuildCopy("${MakeDirPropExpFile}") - set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${MakeDirPropExpFile}) + set(MakeDirPropExpFileAbs "$<TARGET_FILE_DIR:toclean>/${MakeDirPropExpFileRel}") + addPostBuildFile(toclean "${MakeDirPropExpFileAbs}") + set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${MakeDirPropExpFileAbs}) addCleanFile("${CBD}/${MakeDirPropExpFileRel}") endif() @@ -72,34 +75,43 @@ addCleanFile("${DirPropFileAbs}") # Create a custom command whose output should be cleaned, but whose name # is not known until generate-time set(DirPropExpFileRel "DirProp_copy${CMAKE_EXECUTABLE_SUFFIX}") -set(DirPropExpFile "$<TARGET_FILE_DIR:toclean>/${DirPropExpFileRel}") -addToCleanPostBuildCopy("${DirPropExpFile}") -set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_CLEAN_FILES ${DirPropExpFile}) +set(DirPropExpFileAbs "$<TARGET_FILE_DIR:toclean>/${DirPropExpFileRel}") +addPostBuildFile(toclean "${DirPropExpFileAbs}") +set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_CLEAN_FILES ${DirPropExpFileAbs}) addCleanFile("${CBD}/${DirPropExpFileRel}") ### Tests ADDITIONAL_CLEAN_FILES target property -# Register a file path relative to the build directory -set(TgtPropFileRel "TargetPropFileRel.txt") -writeCleanFile("${CBD}/${TgtPropFileRel}") -set_target_properties(toclean PROPERTIES ADDITIONAL_CLEAN_FILES ${TgtPropFileRel}) -addCleanFile("${CBD}/${TgtPropFileRel}") - -# Register an absolute file path -set(TgtPropFileAbs "${CBD}/TargetPropFileAbs.txt") -writeCleanFile("${TgtPropFileAbs}") -set_property(TARGET toclean APPEND PROPERTY ADDITIONAL_CLEAN_FILES ${TgtPropFileAbs}) -addCleanFile("${TgtPropFileAbs}") - -# Create a custom command whose output should be cleaned, but whose name -# is not known until generate-time -set(TgtPropExpFileRel "TgtProp_copy${CMAKE_EXECUTABLE_SUFFIX}") -set(TgtPropExpFile "$<TARGET_FILE_DIR:toclean>/${TgtPropExpFileRel}") -addToCleanPostBuildCopy("${TgtPropExpFile}") -set_property(TARGET toclean APPEND PROPERTY ADDITIONAL_CLEAN_FILES ${TgtPropExpFile}) -addCleanFile("${CBD}/${TgtPropExpFileRel}") +function(test_target_property TARGET) + # Register a file path relative to the build directory + set(TgtPropFileRel "${TARGET}_TargetPropFileRel.txt") + writeCleanFile("${CBD}/${TgtPropFileRel}") + set_target_properties(${TARGET} PROPERTIES ADDITIONAL_CLEAN_FILES ${TgtPropFileRel}) + addCleanFile("${CBD}/${TgtPropFileRel}") + + # Register an absolute file path + set(TgtPropFileAbs "${CBD}/${TARGET}_TargetPropFileAbs.txt") + writeCleanFile("${TgtPropFileAbs}") + set_property(TARGET ${TARGET} APPEND PROPERTY ADDITIONAL_CLEAN_FILES ${TgtPropFileAbs}) + addCleanFile("${TgtPropFileAbs}") + + # Create a custom command whose output should be cleaned, but whose name + # is not known until generate-time + set(TgtPropExpFileRel "${TARGET}_TargetPropGenExp.txt") + set(TgtPropExpFileAbs "$<TARGET_FILE_DIR:toclean>/${TgtPropExpFileRel}") + addPostBuildFile(${TARGET} "${TgtPropExpFileAbs}") + set_property(TARGET ${TARGET} APPEND PROPERTY ADDITIONAL_CLEAN_FILES ${TgtPropExpFileAbs}) + addCleanFile("${CBD}/${TgtPropExpFileRel}") +endfunction() +# Test target property for various target types +add_executable(acf_exec toclean.cxx) +test_target_property(acf_exec) +add_library(acf_lib toclean.cxx) +test_target_property(acf_lib) +add_custom_target(acf_custom ALL DEPENDS ${CustomCommandFile}) +test_target_property(acf_custom) # Process subdirectory without targets add_subdirectory(EmptySubDir) diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index d524f4184..b7f9a37ac 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -200,7 +200,11 @@ function(run_ShowOnly) file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" " add_test(ShowOnly \"${CMAKE_COMMAND}\" -E echo) - set_tests_properties(ShowOnly PROPERTIES WILL_FAIL true _BACKTRACE_TRIPLES \"file1;1;add_test;file0;;\") + set_tests_properties(ShowOnly PROPERTIES + WILL_FAIL true + REQUIRED_FILES RequiredFileDoesNotExist + _BACKTRACE_TRIPLES \"file1;1;add_test;file0;;\" + ) add_test(ShowOnlyNotAvailable NOT_AVAILABLE) ") run_cmake_command(show-only_human ${CMAKE_CTEST_COMMAND} --show-only=human) diff --git a/Tests/RunCMake/CTestCommandLine/show-only_json-v1_check.py b/Tests/RunCMake/CTestCommandLine/show-only_json-v1_check.py index 4dff90cd0..3ad576813 100644 --- a/Tests/RunCMake/CTestCommandLine/show-only_json-v1_check.py +++ b/Tests/RunCMake/CTestCommandLine/show-only_json-v1_check.py @@ -63,6 +63,15 @@ def check_command(c): assert is_string(c[2]) assert c[2] == "echo" +def check_reqfiles_property(p): + assert is_dict(p) + assert sorted(p.keys()) == ["name", "value"] + assert is_string(p["name"]) + assert is_list(p["value"]) + assert p["name"] == "REQUIRED_FILES" + assert len(p["value"]) == 1 + assert p["value"][0] == "RequiredFileDoesNotExist" + def check_willfail_property(p): assert is_dict(p) assert sorted(p.keys()) == ["name", "value"] @@ -81,9 +90,10 @@ def check_workingdir_property(p): def check_properties(p): assert is_list(p) - assert len(p) == 2 - check_willfail_property(p[0]) - check_workingdir_property(p[1]) + assert len(p) == 3 + check_reqfiles_property(p[0]) + check_willfail_property(p[1]) + check_workingdir_property(p[2]) def check_tests(t): assert is_list(t) diff --git a/Tests/RunCMake/CTestCommandLine/show_only_json_check.pyc b/Tests/RunCMake/CTestCommandLine/show_only_json_check.pyc Binary files differindex 8ab379361..d9713380a 100644 --- a/Tests/RunCMake/CTestCommandLine/show_only_json_check.pyc +++ b/Tests/RunCMake/CTestCommandLine/show_only_json_check.pyc diff --git a/Tests/RunCMake/FileAPI/check_index.pyc b/Tests/RunCMake/FileAPI/check_index.pyc Binary files differindex 0bd932b2f..bd5105010 100644 --- a/Tests/RunCMake/FileAPI/check_index.pyc +++ b/Tests/RunCMake/FileAPI/check_index.pyc diff --git a/Tests/RunCMake/FindBoost/CMakePackage_New/BoostConfig.cmake b/Tests/RunCMake/FindBoost/CMakePackage_New/BoostConfig.cmake index 3a88f262a..115151476 100644 --- a/Tests/RunCMake/FindBoost/CMakePackage_New/BoostConfig.cmake +++ b/Tests/RunCMake/FindBoost/CMakePackage_New/BoostConfig.cmake @@ -8,6 +8,7 @@ set_target_properties(Boost::date_time PROPERTIES IMPORTED_CONFIGURATIONS RELEASE IMPORTED_LOCATION_RELEASE "${CMAKE_CURRENT_LIST_DIR}/lib/libboost_date_time.a" ) + set(Boost_python37_FOUND 1) add_library(Boost::python UNKNOWN IMPORTED) set_target_properties(Boost::python PROPERTIES @@ -15,6 +16,10 @@ set_target_properties(Boost::python PROPERTIES IMPORTED_LOCATION_RELEASE "${CMAKE_CURRENT_LIST_DIR}/lib/libboost_python_release.a" IMPORTED_LOCATION_DEBUG "${CMAKE_CURRENT_LIST_DIR}/lib/libboost_python.a" ) +# Versioned target alias for compatibility (added by upstream BoostConfig). +add_library(Boost::python37 INTERFACE IMPORTED) +set_property(TARGET Boost::python37 APPEND PROPERTY INTERFACE_LINK_LIBRARIES Boost::python) + set(Boost_mpi_python2_FOUND 1) add_library(Boost::mpi_python UNKNOWN IMPORTED) set_target_properties(Boost::mpi_python PROPERTIES diff --git a/Tests/RunCMake/find_path/EmptyOldStyle-stdout.txt b/Tests/RunCMake/find_path/EmptyOldStyle-stdout.txt new file mode 100644 index 000000000..8f21eb85c --- /dev/null +++ b/Tests/RunCMake/find_path/EmptyOldStyle-stdout.txt @@ -0,0 +1 @@ +-- VAR-NOTFOUND diff --git a/Tests/RunCMake/find_path/EmptyOldStyle.cmake b/Tests/RunCMake/find_path/EmptyOldStyle.cmake new file mode 100644 index 000000000..d78bb65e0 --- /dev/null +++ b/Tests/RunCMake/find_path/EmptyOldStyle.cmake @@ -0,0 +1,2 @@ +find_path(VAR ONLY_CMAKE_FIND_ROOT_PATH) +message(STATUS "${VAR}") diff --git a/Tests/RunCMake/find_path/RunCMakeTest.cmake b/Tests/RunCMake/find_path/RunCMakeTest.cmake index bf0fa8951..3afbedc90 100644 --- a/Tests/RunCMake/find_path/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_path/RunCMakeTest.cmake @@ -1,5 +1,6 @@ include(RunCMake) +run_cmake(EmptyOldStyle) if(WIN32 OR CYGWIN) run_cmake(PrefixInPATH) endif() |