diff options
-rw-r--r-- | Help/manual/cmake-policies.7.rst | 9 | ||||
-rw-r--r-- | Help/prop_tgt/FRAMEWORK.rst | 4 | ||||
-rw-r--r-- | Modules/FindMPI.cmake | 5 | ||||
-rw-r--r-- | Modules/FindMatlab.cmake | 8 | ||||
-rw-r--r-- | Modules/FindProtobuf.cmake | 5 | ||||
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/cmExportCommand.cxx | 11 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 8 | ||||
-rw-r--r-- | Source/cmNinjaNormalTargetGenerator.cxx | 15 | ||||
-rw-r--r-- | Source/cmRuntimeDependencyArchive.cxx | 5 | ||||
-rw-r--r-- | Tests/CMakeLists.txt | 216 | ||||
-rw-r--r-- | Tests/FindIconv/Test/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/export/Empty.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/export/RunCMakeTest.cmake | 1 |
14 files changed, 94 insertions, 198 deletions
diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index bac1c6c..d7207e1 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -51,13 +51,20 @@ The :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` variable may also be used to determine whether to report an error on use of deprecated macros or functions. -Policies Introduced by CMake 3.15 +Policies Introduced by CMake 3.16 ================================= .. toctree:: :maxdepth: 1 CMP0095: RPATH entries are properly escaped in the intermediary CMake install script. </policy/CMP0095> + +Policies Introduced by CMake 3.15 +================================= + +.. toctree:: + :maxdepth: 1 + CMP0094: FindPython3, FindPython2 and FindPython use LOCATION for lookup strategy. </policy/CMP0094> CMP0093: FindBoost reports Boost_VERSION in x.y.z format. </policy/CMP0093> CMP0092: MSVC warning flags are not in CMAKE_{C,CXX}_FLAGS by default. </policy/CMP0092> diff --git a/Help/prop_tgt/FRAMEWORK.rst b/Help/prop_tgt/FRAMEWORK.rst index 9dad060..3dff1be 100644 --- a/Help/prop_tgt/FRAMEWORK.rst +++ b/Help/prop_tgt/FRAMEWORK.rst @@ -6,7 +6,9 @@ Build ``SHARED`` or ``STATIC`` library as Framework Bundle on the macOS and iOS. If such a library target has this property set to ``TRUE`` it will be built as a framework when built on the macOS and iOS. It will have the directory structure required for a framework and will be suitable to -be used with the ``-framework`` option +be used with the ``-framework`` option. This property is initialized by the +value of the :variable:`CMAKE_FRAMEWORK` variable if it is set when a target is +created. To customize ``Info.plist`` file in the framework, use :prop_tgt:`MACOSX_FRAMEWORK_INFO_PLIST` target property. diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index a80f799..fc9810c 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -1142,16 +1142,15 @@ macro(_MPI_create_imported_target LANG) set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${MPI_${LANG}_COMPILE_DEFINITIONS}") - set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_LINK_LIBRARIES "") if(MPI_${LANG}_LINK_FLAGS) separate_arguments(_MPI_${LANG}_LINK_FLAGS NATIVE_COMMAND "${MPI_${LANG}_LINK_FLAGS}") - set_property(TARGET MPI::MPI_${LANG} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${_MPI_${LANG}_LINK_FLAGS}") + set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_LINK_OPTIONS "${_MPI_${LANG}_LINK_FLAGS}") unset(_MPI_${LANG}_LINK_FLAGS) endif() # If the compiler links MPI implicitly, no libraries will be found as they're contained within # CMAKE_<LANG>_IMPLICIT_LINK_LIBRARIES already. if(MPI_${LANG}_LIBRARIES) - set_property(TARGET MPI::MPI_${LANG} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${MPI_${LANG}_LIBRARIES}") + set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_LINK_LIBRARIES "${MPI_${LANG}_LIBRARIES}") endif() # Given the new design of FindMPI, INCLUDE_DIRS will always be located, even under implicit linking. set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${MPI_${LANG}_INCLUDE_DIRS}") diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index b36dbf7..5138f2a 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -1057,7 +1057,7 @@ function(matlab_add_mex) # This one is weird, it might be a bug in <mex.h> for R2018b. When compiling with # -fvisibility=hidden, the symbol `mexFunction` cannot be exported. Reading the # source code for <mex.h>, it seems that the preprocessor macro `MW_NEEDS_VERSION_H` - # needs to be defined for `__attribute__ ((visibility("default")))` to be added + # needs to be defined for `__attribute__((visibility("default")))` to be added # in front of the declaration of `mexFunction`. In previous versions of MATLAB this # was not the case, there `DLL_EXPORT_SYM` needed to be defined. # Adding `-fvisibility=hidden` to the `mex` command causes the build to fail. @@ -1093,11 +1093,13 @@ function(matlab_add_mex) set(_link_flags "${_link_flags} -Wl,${_export_flag_name},${_file}") endforeach() + # The `mex` command doesn't add this define. It is specified here in order + # to export the symbol in case the client code decides to hide its symbols set_target_properties(${${prefix}_NAME} PROPERTIES - DEFINE_SYMBOL "DLL_EXPORT_SYM=__attribute__ ((visibility (\"default\")))" + DEFINE_SYMBOL "DLL_EXPORT_SYM=__attribute__((visibility(\"default\")))" LINK_FLAGS "${_link_flags}" - ) # The `mex` command doesn't add this define. Is it necessary? + ) endif() diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index 76bc873..085e96c 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -521,6 +521,11 @@ if(Protobuf_INCLUDE_DIR) set_target_properties(protobuf::libprotobuf PROPERTIES IMPORTED_LOCATION_DEBUG "${Protobuf_LIBRARY_DEBUG}") endif() + if (Protobuf_VERSION VERSION_GREATER_EQUAL "3.6") + set_property(TARGET protobuf::libprotobuf APPEND PROPERTY + INTERFACE_COMPILE_FEATURES cxx_std_11 + ) + endif() if(UNIX AND TARGET Threads::Threads) set_property(TARGET protobuf::libprotobuf APPEND PROPERTY INTERFACE_LINK_LIBRARIES Threads::Threads) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 4517bdf..a054b11 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 20190625) +set(CMake_VERSION_PATCH 20190626) #set(CMake_VERSION_RC 1) diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index 5b611c0..a849aa2 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -4,6 +4,8 @@ #include "cm_static_string_view.hxx" #include "cmsys/RegularExpression.hxx" + +#include <algorithm> #include <map> #include <sstream> #include <utility> @@ -66,7 +68,9 @@ bool cmExportCommand::InitialPass(std::vector<std::string> const& args, } std::vector<std::string> unknownArgs; - Arguments const arguments = parser.Parse(args, &unknownArgs); + std::vector<std::string> keywordsMissingValue; + Arguments const arguments = + parser.Parse(args, &unknownArgs, &keywordsMissingValue); if (!unknownArgs.empty()) { this->SetError("Unknown argument: \"" + unknownArgs.front() + "\"."); @@ -128,7 +132,10 @@ bool cmExportCommand::InitialPass(std::vector<std::string> const& args, return false; } ExportSet = it->second; - } else if (!arguments.Targets.empty()) { + } else if (!arguments.Targets.empty() || + std::find(keywordsMissingValue.begin(), + keywordsMissingValue.end(), + "TARGETS") != keywordsMissingValue.end()) { for (std::string const& currentTarget : arguments.Targets) { if (this->Makefile->IsAlias(currentTarget)) { std::ostringstream e; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 3abf2dd..801f0e8 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1017,7 +1017,7 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit( } for (std::string const& i : impDirVec) { - if (implicitSet.insert(i).second) { + if (implicitSet.insert(cmSystemTools::GetRealPath(i)).second) { implicitDirs.emplace_back(i); } } @@ -1028,7 +1028,8 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit( &lang](std::string const& dir) { return ( // Do not exclude directories that are not in an excluded set. - ((implicitSet.find(dir) == implicitSet.end()) && + ((implicitSet.find(cmSystemTools::GetRealPath(dir)) == + implicitSet.end()) && (implicitExclude.find(dir) == implicitExclude.end())) // Do not exclude entries of the CPATH environment variable even though // they are implicitly searched by the compiler. They are meant to be @@ -1082,7 +1083,8 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit( if (!stripImplicitDirs) { // Append implicit directories that were requested by the user only for (BT<std::string> const& udr : userDirs) { - if (implicitSet.find(udr.Value) != implicitSet.end()) { + if (implicitSet.find(cmSystemTools::GetRealPath(udr.Value)) != + implicitSet.end()) { emitBT(udr); } } diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 7ad8ab3..f65abc8 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -171,20 +171,9 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkRule(bool useResponseFile) vars.Language = "CUDA"; - std::string responseFlag; - - std::string cmakeVarLang = "CMAKE_"; - cmakeVarLang += this->TargetLinkLanguage; - // build response file name - std::string cmakeLinkVar = cmakeVarLang + "_RESPONSE_FILE_LINK_FLAG"; - const char* flag = GetMakefile()->GetDefinition(cmakeLinkVar); - - if (flag) { - responseFlag = flag; - } else if (this->TargetLinkLanguage != "CUDA") { - responseFlag = "@"; - } + std::string responseFlag = this->GetMakefile()->GetSafeDefinition( + "CMAKE_CUDA_RESPONSE_FILE_LINK_FLAG"); if (!useResponseFile || responseFlag.empty()) { vars.Objects = "$in"; diff --git a/Source/cmRuntimeDependencyArchive.cxx b/Source/cmRuntimeDependencyArchive.cxx index b4c6c32..a1d1f95 100644 --- a/Source/cmRuntimeDependencyArchive.cxx +++ b/Source/cmRuntimeDependencyArchive.cxx @@ -342,10 +342,7 @@ void cmRuntimeDependencyArchive::AddResolvedPath(const std::string& name, const std::string& path, bool& unique) { - auto it = - this->ResolvedPaths - .insert(std::pair<std::string, std::set<std::string>>{ name, {} }) - .first; + auto it = this->ResolvedPaths.emplace(name, std::set<std::string>{}).first; unique = true; for (auto const& other : it->second) { if (cmSystemTools::SameFile(path, other)) { diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index b766838..a81ea5b 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1398,184 +1398,66 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH endif() endif() - if(CMake_TEST_FindALSA) - add_subdirectory(FindALSA) - endif() + # test for Find modules, simple cases + foreach(_mod IN ITEMS + ALSA + Boost + BZip2 + CURL + Cups + Doxygen + EnvModules + EXPAT + Fontconfig + Freetype + GDAL + GIF + Git + GLEW + GSL + GTK2 + Iconv + ICU + JPEG + JsonCpp + LibLZMA + LibRHash + Libinput + LibUV + LibXml2 + LTTngUST + ODBC + OpenCL + OpenGL + OpenMP + OpenSSL + MPI + PNG + Patch + PostgreSQL + Protobuf + SQLite3 + TIFF + Vulkan + X11 + XalanC + XercesC + ) + if(CMake_TEST_Find${_mod}) + add_subdirectory(Find${_mod}) + endif() + endforeach() if(CMake_TEST_CUDA) add_subdirectory(Cuda) add_subdirectory(CudaOnly) endif() - if(CMake_TEST_FindBoost) - add_subdirectory(FindBoost) - endif() - - if(CMake_TEST_FindBZip2) - add_subdirectory(FindBZip2) - endif() - - if(CMake_TEST_FindCURL) - add_subdirectory(FindCURL) - endif() - - if(CMake_TEST_FindCups) - add_subdirectory(FindCups) - endif() - - if(CMake_TEST_FindDoxygen) - add_subdirectory(FindDoxygen) - endif() - - if(CMake_TEST_FindEnvModules) - add_subdirectory(FindEnvModules) - endif() - - if(CMake_TEST_FindEXPAT) - add_subdirectory(FindEXPAT) - endif() - - if(CMake_TEST_FindFontconfig) - add_subdirectory(FindFontconfig) - endif() - - if(CMake_TEST_FindFreetype) - add_subdirectory(FindFreetype) - endif() - - if(CMake_TEST_FindGDAL) - add_subdirectory(FindGDAL) - endif() - - if(CMake_TEST_FindGIF) - add_subdirectory(FindGIF) - endif() - - if(CMake_TEST_FindGit) - add_subdirectory(FindGit) - endif() - - if(CMake_TEST_FindGLEW) - add_subdirectory(FindGLEW) - endif() - - if(CMake_TEST_FindGSL) - add_subdirectory(FindGSL) - endif() - if(CMake_TEST_FindGTest) add_subdirectory(FindGTest) add_subdirectory(GoogleTest) endif() - if(CMake_TEST_FindGTK2) - add_subdirectory(FindGTK2) - endif() - - if(CMake_TEST_FindIconv) - add_subdirectory(FindIconv) - endif() - - if(CMake_TEST_FindICU) - add_subdirectory(FindICU) - endif() - - if(CMake_TEST_FindJPEG) - add_subdirectory(FindJPEG) - endif() - - if(CMake_TEST_FindJsonCpp) - add_subdirectory(FindJsonCpp) - endif() - - if(CMake_TEST_FindLibLZMA) - add_subdirectory(FindLibLZMA) - endif() - - if(CMake_TEST_FindLibRHash) - add_subdirectory(FindLibRHash) - endif() - - if(CMake_TEST_FindLibinput) - add_subdirectory(FindLibinput) - endif() - - if(CMake_TEST_FindLibUV) - add_subdirectory(FindLibUV) - endif() - - if(CMake_TEST_FindLibXml2) - add_subdirectory(FindLibXml2) - endif() - - if(CMake_TEST_FindLTTngUST) - add_subdirectory(FindLTTngUST) - endif() - - if(CMake_TEST_FindODBC) - add_subdirectory(FindODBC) - endif() - - if(CMake_TEST_FindOpenCL) - add_subdirectory(FindOpenCL) - endif() - - if(CMake_TEST_FindOpenGL) - add_subdirectory(FindOpenGL) - endif() - - if(CMake_TEST_FindOpenMP) - add_subdirectory(FindOpenMP) - endif() - - if(CMake_TEST_FindOpenSSL) - add_subdirectory(FindOpenSSL) - endif() - - if(CMake_TEST_FindMPI) - add_subdirectory(FindMPI) - endif() - - if(CMake_TEST_FindPNG) - add_subdirectory(FindPNG) - endif() - - if(CMake_TEST_FindPatch) - add_subdirectory(FindPatch) - endif() - - if(CMake_TEST_FindPostgreSQL) - add_subdirectory(FindPostgreSQL) - endif() - - if(CMake_TEST_FindProtobuf) - add_subdirectory(FindProtobuf) - endif() - - if(CMake_TEST_FindSQLite3) - add_subdirectory(FindSQLite3) - endif() - - if(CMake_TEST_FindTIFF) - add_subdirectory(FindTIFF) - endif() - - if(CMake_TEST_FindVulkan) - add_subdirectory(FindVulkan) - endif() - - if(CMake_TEST_FindX11) - add_subdirectory(FindX11) - endif() - - if(CMake_TEST_FindXalanC) - add_subdirectory(FindXalanC) - endif() - - if(CMake_TEST_FindXercesC) - add_subdirectory(FindXercesC) - endif() - if(CMake_TEST_FindPython OR CMake_TEST_FindPython_NumPy) add_subdirectory(FindPython) endif() diff --git a/Tests/FindIconv/Test/CMakeLists.txt b/Tests/FindIconv/Test/CMakeLists.txt index c59adb3..a6243f5 100644 --- a/Tests/FindIconv/Test/CMakeLists.txt +++ b/Tests/FindIconv/Test/CMakeLists.txt @@ -6,9 +6,11 @@ find_package(Iconv REQUIRED) add_executable(test_iconv_tgt main.cxx) target_link_libraries(test_iconv_tgt Iconv::Iconv) +target_compile_features(test_iconv_tgt PRIVATE cxx_std_11) add_test(NAME test_iconv_tgt COMMAND test_iconv_tgt) add_executable(test_iconv_var main.cxx) target_include_directories(test_iconv_var PRIVATE ${Iconv_INCLUDE_DIRS}) target_link_libraries(test_iconv_var PRIVATE ${Iconv_LIBRARIES}) +target_compile_features(test_iconv_var PRIVATE cxx_std_11) add_test(NAME test_iconv_var COMMAND test_iconv_var) diff --git a/Tests/RunCMake/export/Empty.cmake b/Tests/RunCMake/export/Empty.cmake new file mode 100644 index 0000000..2198ddf --- /dev/null +++ b/Tests/RunCMake/export/Empty.cmake @@ -0,0 +1 @@ +export(TARGETS FILE targets.cmake) diff --git a/Tests/RunCMake/export/RunCMakeTest.cmake b/Tests/RunCMake/export/RunCMakeTest.cmake index 46bb1fc..97a0ca6 100644 --- a/Tests/RunCMake/export/RunCMakeTest.cmake +++ b/Tests/RunCMake/export/RunCMakeTest.cmake @@ -1,6 +1,7 @@ include(RunCMake) run_cmake(CustomTarget) +run_cmake(Empty) run_cmake(TargetNotFound) run_cmake(AppendExport) run_cmake(OldIface) |