diff options
68 files changed, 790 insertions, 537 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e4cd15..41ff4a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -451,7 +451,7 @@ endif() # CMAKE_TESTS_CDASH_SERVER: CDash server used by CMake/Tests. # # If not defined or "", this variable defaults to the server at -# http://www.cdash.org/CDash. +# "http://open.cdash.org". # # If set explicitly to "NOTFOUND", curl tests and ctest tests that use # the network are skipped. @@ -462,7 +462,7 @@ endif() # should be run first. # if("x${CMAKE_TESTS_CDASH_SERVER}" STREQUAL "x") - set(CMAKE_TESTS_CDASH_SERVER "http://www.cdash.org/CDash") + set(CMAKE_TESTS_CDASH_SERVER "http://open.cdash.org") endif() if(NOT CMake_TEST_EXTERNAL_CMAKE) diff --git a/CTestConfig.cmake b/CTestConfig.cmake index 819f9ba..df2f94c 100644 --- a/CTestConfig.cmake +++ b/CTestConfig.cmake @@ -13,8 +13,8 @@ set(CTEST_PROJECT_NAME "CMake") set(CTEST_NIGHTLY_START_TIME "1:00:00 UTC") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=CMake") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=CMake") set(CTEST_DROP_SITE_CDASH TRUE) set(CTEST_CDASH_VERSION "1.6") set(CTEST_CDASH_QUERY_VERSION TRUE) diff --git a/DartConfig.cmake b/DartConfig.cmake index 37f66c7..92dffca 100644 --- a/DartConfig.cmake +++ b/DartConfig.cmake @@ -13,6 +13,6 @@ set(CTEST_PROJECT_NAME "CMake") set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=CMake") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=CMake") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index 5743ab7..8dfc16a 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -38,7 +38,7 @@ Options For true platform independence, CMake provides a list of commands that can be used on all systems. Run with -E help for the usage information. Commands available are: chdir, compare_files, copy, - copy_directory, copy_if_different, echo, echo_append, environment, + copy_directory, copy_if_different, echo, echo_append, env, environment, make_directory, md5sum, remove, remove_directory, rename, sleep, tar, time, touch, touch_nocreate. In addition, some platform specific commands are available. On Windows: delete_regv, write_regv. On diff --git a/Help/release/dev/cmake-E-env.rst b/Help/release/dev/cmake-E-env.rst new file mode 100644 index 0000000..4bdcd0c --- /dev/null +++ b/Help/release/dev/cmake-E-env.rst @@ -0,0 +1,4 @@ +cmake-E-env +----------- + +* The :manual:`cmake(1)` ``-E`` option learned a new ``env`` command. diff --git a/Help/release/dev/find-module-targets.rst b/Help/release/dev/find-module-targets.rst new file mode 100644 index 0000000..98ea283 --- /dev/null +++ b/Help/release/dev/find-module-targets.rst @@ -0,0 +1,8 @@ +find-module-targets +------------------- + +* The :module:`FindGLUT` module now provides imported targets. + +* The :module:`FindGLEW` module now provides imported targets. + +* The :module:`FindZLIB` module now provides imported targets. diff --git a/Modules/FindGLEW.cmake b/Modules/FindGLEW.cmake index 497a80c..f42182f 100644 --- a/Modules/FindGLEW.cmake +++ b/Modules/FindGLEW.cmake @@ -4,6 +4,15 @@ # # Find the OpenGL Extension Wrangler Library (GLEW) # +# IMPORTED Targets +# ^^^^^^^^^^^^^^^^ +# +# This module defines the :prop_tgt:`IMPORTED` target ``GLEW::GLEW``, +# if GLEW has been found. +# +# Result Variables +# ^^^^^^^^^^^^^^^^ +# # This module defines the following variables: # # :: @@ -35,4 +44,11 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) find_package_handle_standard_args(GLEW REQUIRED_VARS GLEW_INCLUDE_DIR GLEW_LIBRARY) +if(GLEW_FOUND AND NOT TARGET GLEW::GLEW) + add_library(GLEW::GLEW UNKNOWN IMPORTED) + set_target_properties(GLEW::GLEW PROPERTIES + IMPORTED_LOCATION "${GLEW_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${GLEW_INCLUDE_DIRS}") +endif() + mark_as_advanced(GLEW_INCLUDE_DIR GLEW_LIBRARY) diff --git a/Modules/FindGLUT.cmake b/Modules/FindGLUT.cmake index be7c0cd..c9f7597 100644 --- a/Modules/FindGLUT.cmake +++ b/Modules/FindGLUT.cmake @@ -2,7 +2,20 @@ # FindGLUT # -------- # -# try to find glut library and include files +# try to find glut library and include files. +# +# IMPORTED Targets +# ^^^^^^^^^^^^^^^^ +# +# This module defines the :prop_tgt:`IMPORTED` targets: +# +# ``GLUT::GLUT`` +# Defined if the system has GLUT. +# +# Result Variables +# ^^^^^^^^^^^^^^^^ +# +# This module sets the following variables: # # :: # @@ -42,13 +55,21 @@ if (WIN32) else () if (APPLE) - # These values for Apple could probably do with improvement. - find_path( GLUT_INCLUDE_DIR glut.h - /System/Library/Frameworks/GLUT.framework/Versions/A/Headers - ${OPENGL_LIBRARY_DIR} - ) - set(GLUT_glut_LIBRARY "-framework GLUT" CACHE STRING "GLUT library for OSX") - set(GLUT_cocoa_LIBRARY "-framework Cocoa" CACHE STRING "Cocoa framework for OSX") + find_path(GLUT_INCLUDE_DIR glut.h ${OPENGL_LIBRARY_DIR}) + find_library(GLUT_glut_LIBRARY GLUT DOC "GLUT library for OSX") + find_library(GLUT_cocoa_LIBRARY Cocoa DOC "Cocoa framework for OSX") + + if(GLUT_cocoa_LIBRARY AND NOT TARGET GLUT::Cocoa) + add_library(GLUT::Cocoa UNKNOWN IMPORTED) + # Cocoa should always be a Framework, but we check to make sure. + if(GLUT_cocoa_LIBRARY MATCHES "/([^/]+)\\.framework$") + set_target_properties(GLUT::Cocoa PROPERTIES + IMPORTED_LOCATION "${GLUT_cocoa_LIBRARY}/${CMAKE_MATCH_1}") + else() + set_target_properties(GLUT::Cocoa PROPERTIES + IMPORTED_LOCATION "${GLUT_cocoa_LIBRARY}") + endif() + endif() else () if (BEOS) @@ -66,6 +87,18 @@ else () /usr/openwin/lib ) + if(GLUT_Xi_LIBRARY AND NOT TARGET GLUT::Xi) + add_library(GLUT::Xi UNKNOWN IMPORTED) + set_target_properties(GLUT::Xi PROPERTIES + IMPORTED_LOCATION "${GLUT_Xi_LIBRARY}") + endif() + + if(GLUT_Xmu_LIBRARY AND NOT TARGET GLUT::Xmu) + add_library(GLUT::Xmu UNKNOWN IMPORTED) + set_target_properties(GLUT::Xmu PROPERTIES + IMPORTED_LOCATION "${GLUT_Xmu_LIBRARY}") + endif() + endif () find_path( GLUT_INCLUDE_DIR GL/glut.h @@ -102,6 +135,34 @@ if (GLUT_FOUND) ${GLUT_cocoa_LIBRARY} ) + if(NOT TARGET GLUT::GLUT) + add_library(GLUT::GLUT UNKNOWN IMPORTED) + set_target_properties(GLUT::GLUT PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${GLUT_INCLUDE_DIR}") + if(GLUT_glut_LIBRARY MATCHES "/([^/]+)\\.framework$") + set_target_properties(GLUT::GLUT PROPERTIES + IMPORTED_LOCATION "${GLUT_glut_LIBRARY}/${CMAKE_MATCH_1}") + else() + set_target_properties(GLUT::GLUT PROPERTIES + IMPORTED_LOCATION "${GLUT_glut_LIBRARY}") + endif() + + if(TARGET GLUT::Xmu) + set_property(TARGET GLUT::GLUT APPEND + PROPERTY INTERFACE_LINK_LIBRARIES GLUT::Xmu) + endif() + + if(TARGET GLUT::Xi) + set_property(TARGET GLUT::GLUT APPEND + PROPERTY INTERFACE_LINK_LIBRARIES GLUT::Xi) + endif() + + if(TARGET GLUT::Cocoa) + set_property(TARGET GLUT::GLUT APPEND + PROPERTY INTERFACE_LINK_LIBRARIES GLUT::Cocoa) + endif() + endif() + #The following deprecated settings are for backwards compatibility with CMake1.4 set (GLUT_LIBRARY ${GLUT_LIBRARIES}) set (GLUT_INCLUDE_PATH ${GLUT_INCLUDE_DIR}) diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake index 3a31cf0..90c1499 100644 --- a/Modules/FindX11.cmake +++ b/Modules/FindX11.cmake @@ -4,7 +4,7 @@ # # Find X11 installation # -# Try to find X11 on UNIX systems. The following values are defined +# Try to find X11 on UNIX systems. The following values are defined # # :: # @@ -12,47 +12,44 @@ # X11_INCLUDE_DIR - include directories to use X11 # X11_LIBRARIES - link against these to use X11 # -# -# -# and also the following more fine grained variables: Include paths: -# X11_ICE_INCLUDE_PATH, X11_ICE_LIB, X11_ICE_FOUND +# and also the following more fine grained variables: # # :: # -# X11_SM_INCLUDE_PATH, X11_SM_LIB, X11_SM_FOUND -# X11_X11_INCLUDE_PATH, X11_X11_LIB -# X11_Xaccessrules_INCLUDE_PATH, X11_Xaccess_FOUND -# X11_Xaccessstr_INCLUDE_PATH, X11_Xaccess_FOUND -# X11_Xau_INCLUDE_PATH, X11_Xau_LIB, X11_Xau_FOUND -# X11_Xcomposite_INCLUDE_PATH, X11_Xcomposite_LIB, X11_Xcomposite_FOUND -# X11_Xcursor_INCLUDE_PATH, X11_Xcursor_LIB, X11_Xcursor_FOUND -# X11_Xdamage_INCLUDE_PATH, X11_Xdamage_LIB, X11_Xdamage_FOUND -# X11_Xdmcp_INCLUDE_PATH, X11_Xdmcp_LIB, X11_Xdmcp_FOUND -# X11_Xext_LIB, X11_Xext_FOUND -# X11_dpms_INCLUDE_PATH, (in X11_Xext_LIB), X11_dpms_FOUND -# X11_XShm_INCLUDE_PATH, (in X11_Xext_LIB), X11_XShm_FOUND -# X11_Xshape_INCLUDE_PATH, (in X11_Xext_LIB), X11_Xshape_FOUND -# X11_xf86misc_INCLUDE_PATH, X11_Xxf86misc_LIB, X11_xf86misc_FOUND -# X11_xf86vmode_INCLUDE_PATH, X11_Xxf86vm_LIB X11_xf86vmode_FOUND -# X11_Xfixes_INCLUDE_PATH, X11_Xfixes_LIB, X11_Xfixes_FOUND -# X11_Xft_INCLUDE_PATH, X11_Xft_LIB, X11_Xft_FOUND -# X11_Xi_INCLUDE_PATH, X11_Xi_LIB, X11_Xi_FOUND -# X11_Xinerama_INCLUDE_PATH, X11_Xinerama_LIB, X11_Xinerama_FOUND -# X11_Xinput_INCLUDE_PATH, X11_Xinput_LIB, X11_Xinput_FOUND -# X11_Xkb_INCLUDE_PATH, X11_Xkb_FOUND -# X11_Xkblib_INCLUDE_PATH, X11_Xkb_FOUND -# X11_Xkbfile_INCLUDE_PATH, X11_Xkbfile_LIB, X11_Xkbfile_FOUND -# X11_Xmu_INCLUDE_PATH, X11_Xmu_LIB, X11_Xmu_FOUND -# X11_Xpm_INCLUDE_PATH, X11_Xpm_LIB, X11_Xpm_FOUND -# X11_XTest_INCLUDE_PATH, X11_XTest_LIB, X11_XTest_FOUND -# X11_Xrandr_INCLUDE_PATH, X11_Xrandr_LIB, X11_Xrandr_FOUND -# X11_Xrender_INCLUDE_PATH, X11_Xrender_LIB, X11_Xrender_FOUND -# X11_Xscreensaver_INCLUDE_PATH, X11_Xscreensaver_LIB, X11_Xscreensaver_FOUND -# X11_Xt_INCLUDE_PATH, X11_Xt_LIB, X11_Xt_FOUND -# X11_Xutil_INCLUDE_PATH, X11_Xutil_FOUND -# X11_Xv_INCLUDE_PATH, X11_Xv_LIB, X11_Xv_FOUND -# X11_XSync_INCLUDE_PATH, (in X11_Xext_LIB), X11_XSync_FOUND - +# X11_ICE_INCLUDE_PATH, X11_ICE_LIB, X11_ICE_FOUND +# X11_SM_INCLUDE_PATH, X11_SM_LIB, X11_SM_FOUND +# X11_X11_INCLUDE_PATH, X11_X11_LIB +# X11_Xaccessrules_INCLUDE_PATH, X11_Xaccess_FOUND +# X11_Xaccessstr_INCLUDE_PATH, X11_Xaccess_FOUND +# X11_Xau_INCLUDE_PATH, X11_Xau_LIB, X11_Xau_FOUND +# X11_Xcomposite_INCLUDE_PATH, X11_Xcomposite_LIB, X11_Xcomposite_FOUND +# X11_Xcursor_INCLUDE_PATH, X11_Xcursor_LIB, X11_Xcursor_FOUND +# X11_Xdamage_INCLUDE_PATH, X11_Xdamage_LIB, X11_Xdamage_FOUND +# X11_Xdmcp_INCLUDE_PATH, X11_Xdmcp_LIB, X11_Xdmcp_FOUND +# X11_Xext_LIB, X11_Xext_FOUND +# X11_dpms_INCLUDE_PATH, (in X11_Xext_LIB), X11_dpms_FOUND +# X11_XShm_INCLUDE_PATH, (in X11_Xext_LIB), X11_XShm_FOUND +# X11_Xshape_INCLUDE_PATH, (in X11_Xext_LIB), X11_Xshape_FOUND +# X11_xf86misc_INCLUDE_PATH, X11_Xxf86misc_LIB, X11_xf86misc_FOUND +# X11_xf86vmode_INCLUDE_PATH, X11_Xxf86vm_LIB X11_xf86vmode_FOUND +# X11_Xfixes_INCLUDE_PATH, X11_Xfixes_LIB, X11_Xfixes_FOUND +# X11_Xft_INCLUDE_PATH, X11_Xft_LIB, X11_Xft_FOUND +# X11_Xi_INCLUDE_PATH, X11_Xi_LIB, X11_Xi_FOUND +# X11_Xinerama_INCLUDE_PATH, X11_Xinerama_LIB, X11_Xinerama_FOUND +# X11_Xinput_INCLUDE_PATH, X11_Xinput_LIB, X11_Xinput_FOUND +# X11_Xkb_INCLUDE_PATH, X11_Xkb_FOUND +# X11_Xkblib_INCLUDE_PATH, X11_Xkb_FOUND +# X11_Xkbfile_INCLUDE_PATH, X11_Xkbfile_LIB, X11_Xkbfile_FOUND +# X11_Xmu_INCLUDE_PATH, X11_Xmu_LIB, X11_Xmu_FOUND +# X11_Xpm_INCLUDE_PATH, X11_Xpm_LIB, X11_Xpm_FOUND +# X11_XTest_INCLUDE_PATH, X11_XTest_LIB, X11_XTest_FOUND +# X11_Xrandr_INCLUDE_PATH, X11_Xrandr_LIB, X11_Xrandr_FOUND +# X11_Xrender_INCLUDE_PATH, X11_Xrender_LIB, X11_Xrender_FOUND +# X11_Xscreensaver_INCLUDE_PATH, X11_Xscreensaver_LIB, X11_Xscreensaver_FOUND +# X11_Xt_INCLUDE_PATH, X11_Xt_LIB, X11_Xt_FOUND +# X11_Xutil_INCLUDE_PATH, X11_Xutil_FOUND +# X11_Xv_INCLUDE_PATH, X11_Xv_LIB, X11_Xv_FOUND +# X11_XSync_INCLUDE_PATH, (in X11_Xext_LIB), X11_XSync_FOUND #============================================================================= # Copyright 2001-2009 Kitware, Inc. diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake index 8cc382c..d4a27d5 100644 --- a/Modules/FindZLIB.cmake +++ b/Modules/FindZLIB.cmake @@ -2,9 +2,18 @@ # FindZLIB # -------- # -# Find zlib +# Find the native ZLIB includes and library. # -# Find the native ZLIB includes and library. Once done this will define +# IMPORTED Targets +# ^^^^^^^^^^^^^^^^ +# +# This module defines :prop_tgt:`IMPORTED` target ``ZLIB::ZLIB``, if +# ZLIB has been found. +# +# Result Variables +# ^^^^^^^^^^^^^^^^ +# +# This module defines the following variables: # # :: # @@ -12,8 +21,6 @@ # ZLIB_LIBRARIES - List of libraries when using zlib. # ZLIB_FOUND - True if zlib found. # -# -# # :: # # ZLIB_VERSION_STRING - The version of zlib found (x.y.z) @@ -22,7 +29,8 @@ # ZLIB_VERSION_PATCH - The patch version of zlib # ZLIB_VERSION_TWEAK - The tweak version of zlib # -# +# Backward Compatibility +# ^^^^^^^^^^^^^^^^^^^^^^ # # The following variable are provided for backward compatibility # @@ -32,9 +40,10 @@ # ZLIB_MINOR_VERSION - The minor version of zlib # ZLIB_PATCH_VERSION - The patch version of zlib # +# Hints +# ^^^^^ # -# -# An includer may set ZLIB_ROOT to a zlib installation root to tell this +# A user may set ``ZLIB_ROOT`` to a zlib installation root to tell this # module where to look. #============================================================================= @@ -104,5 +113,11 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB REQUIRED_VARS ZLIB_LIBRARY ZLIB_INCLUDE_D if(ZLIB_FOUND) set(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR}) set(ZLIB_LIBRARIES ${ZLIB_LIBRARY}) -endif() + if(NOT TARGET ZLIB::ZLIB) + add_library(ZLIB::ZLIB UNKNOWN IMPORTED) + set_target_properties(ZLIB::ZLIB PROPERTIES + IMPORTED_LOCATION "${ZLIB_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIRS}") + endif() +endif() diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index f83f992..66d300a 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -213,7 +213,6 @@ macro(_test_compiler_hidden_visibility) # Exclude XL here because it misinterprets -fvisibility=hidden even though # the check_cxx_compiler_flag passes - # http://www.cdash.org/CDash/testDetails.php?test=109109951&build=1419259 if(NOT GCC_TOO_OLD AND NOT _INTEL_TOO_OLD AND NOT WIN32 diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 3939aad..9a7a6f2 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 20140623) +set(CMake_VERSION_PATCH 20140627) #set(CMake_VERSION_RC 1) diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 7922c9a..2ec1365 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -605,6 +605,9 @@ void cmCTestBuildHandler::GenerateXMLLaunched(std::ostream& os) typedef std::set<std::string, FragmentCompare> Fragments; Fragments fragments(fragmentCompare); + // only report the first 50 warnings and first 50 errors + int numErrorsAllowed = this->MaxErrors; + int numWarningsAllowed = this->MaxWarnings; // Identify fragments on disk. cmsys::Directory launchDir; launchDir.Load(this->CTestLaunchDir.c_str()); @@ -612,13 +615,15 @@ void cmCTestBuildHandler::GenerateXMLLaunched(std::ostream& os) for(unsigned long i=0; i < n; ++i) { const char* fname = launchDir.GetFile(i); - if(this->IsLaunchedErrorFile(fname)) + if(this->IsLaunchedErrorFile(fname) && numErrorsAllowed) { + numErrorsAllowed--; fragments.insert(this->CTestLaunchDir + "/" + fname); ++this->TotalErrors; } - else if(this->IsLaunchedWarningFile(fname)) + else if(this->IsLaunchedWarningFile(fname) && numWarningsAllowed) { + numWarningsAllowed--; fragments.insert(this->CTestLaunchDir + "/" + fname); ++this->TotalWarnings; } diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 09d0ad8..7b50174 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -918,7 +918,7 @@ cmCTestMemCheckHandler::PostProcessBoundsCheckerTest(cmCTestTestResult& res, cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "PostProcessBoundsCheckerTest for : " << res.Name << std::endl); - std::string ofile = testOutputFileName(test); + std::string ofile = this->TestOutputFileName(test); if ( ofile.empty() ) { return; @@ -957,7 +957,7 @@ cmCTestMemCheckHandler::PostProcessPurifyTest(cmCTestTestResult& res, cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "PostProcessPurifyTest for : " << res.Name << std::endl); - appendMemTesterOutput(res, test); + this->AppendMemTesterOutput(res, test); } void @@ -967,14 +967,14 @@ cmCTestMemCheckHandler::PostProcessValgrindTest(cmCTestTestResult& res, cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "PostProcessValgrindTest for : " << res.Name << std::endl); - appendMemTesterOutput(res, test); + this->AppendMemTesterOutput(res, test); } void -cmCTestMemCheckHandler::appendMemTesterOutput(cmCTestTestResult& res, +cmCTestMemCheckHandler::AppendMemTesterOutput(cmCTestTestResult& res, int test) { - std::string ofile = testOutputFileName(test); + std::string ofile = this->TestOutputFileName(test); if ( ofile.empty() ) { @@ -996,7 +996,7 @@ cmCTestMemCheckHandler::appendMemTesterOutput(cmCTestTestResult& res, } std::string -cmCTestMemCheckHandler::testOutputFileName(int test) +cmCTestMemCheckHandler::TestOutputFileName(int test) { std::string index; cmOStringStream stream; diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h index 0521a48..20a38bb 100644 --- a/Source/CTest/cmCTestMemCheckHandler.h +++ b/Source/CTest/cmCTestMemCheckHandler.h @@ -123,11 +123,11 @@ private: void PostProcessValgrindTest(cmCTestTestResult& res, int test); ///! append MemoryTesterOutputFile to the test log - void appendMemTesterOutput(cmCTestTestHandler::cmCTestTestResult& res, + void AppendMemTesterOutput(cmCTestTestHandler::cmCTestTestResult& res, int test); ///! generate the output filename for the given test index - std::string testOutputFileName(int test); + std::string TestOutputFileName(int test); }; #endif diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 995f191..6170e92 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -172,12 +172,10 @@ satisfy dependencies. //---------------------------------------------------------------------------- cmComputeLinkDepends -::cmComputeLinkDepends(cmTarget const* target, const std::string& config, - cmTarget const* head) +::cmComputeLinkDepends(cmTarget const* target, const std::string& config) { // Store context information. this->Target = target; - this->HeadTarget = head; this->Makefile = this->Target->GetMakefile(); this->LocalGenerator = this->Makefile->GetLocalGenerator(); this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator(); @@ -294,8 +292,7 @@ cmComputeLinkDepends::AllocateLinkEntry(std::string const& item) } //---------------------------------------------------------------------------- -int cmComputeLinkDepends::AddLinkEntry(int depender_index, - std::string const& item) +int cmComputeLinkDepends::AddLinkEntry(cmLinkItem const& item) { // Check if the item entry has already been added. std::map<std::string, int>::iterator lei = this->LinkEntryIndex.find(item); @@ -312,7 +309,7 @@ int cmComputeLinkDepends::AddLinkEntry(int depender_index, int index = lei->second; LinkEntry& entry = this->EntryList[index]; entry.Item = item; - entry.Target = this->FindTargetToLink(depender_index, entry.Item); + entry.Target = item.Target; entry.IsFlag = (!entry.Target && item[0] == '-' && item[1] != 'l' && item.substr(0, 10) != "-framework"); @@ -356,7 +353,7 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry const& qe) { // Follow the target dependencies. if(cmTarget::LinkInterface const* iface = - entry.Target->GetLinkInterface(this->Config, this->HeadTarget)) + entry.Target->GetLinkInterface(this->Config, this->Target)) { const bool isIface = entry.Target->GetType() == cmTarget::INTERFACE_LIBRARY; @@ -372,11 +369,11 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry const& qe) this->FollowSharedDeps(depender_index, iface); // Support for CMP0003. - for(std::vector<std::string>::const_iterator + for(std::vector<cmLinkItem>::const_iterator oi = iface->WrongConfigLibraries.begin(); oi != iface->WrongConfigLibraries.end(); ++oi) { - this->CheckWrongConfigItem(depender_index, *oi); + this->CheckWrongConfigItem(*oi); } } } @@ -408,9 +405,9 @@ cmComputeLinkDepends void cmComputeLinkDepends ::QueueSharedDependencies(int depender_index, - std::vector<std::string> const& deps) + std::vector<cmLinkItem> const& deps) { - for(std::vector<std::string>::const_iterator li = deps.begin(); + for(std::vector<cmLinkItem>::const_iterator li = deps.begin(); li != deps.end(); ++li) { SharedDepEntry qe; @@ -434,8 +431,7 @@ void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep) // Initialize the item entry. LinkEntry& entry = this->EntryList[lei->second]; entry.Item = dep.Item; - entry.Target = this->FindTargetToLink(dep.DependerIndex, - dep.Item); + entry.Target = dep.Item.Target; // This item was added specifically because it is a dependent // shared library. It may get special treatment @@ -455,7 +451,7 @@ void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep) if(entry.Target) { if(cmTarget::LinkInterface const* iface = - entry.Target->GetLinkInterface(this->Config, this->HeadTarget)) + entry.Target->GetLinkInterface(this->Config, this->Target)) { // Follow public and private dependencies transitively. this->FollowSharedDeps(index, iface, true); @@ -474,7 +470,7 @@ void cmComputeLinkDepends::AddVarLinkEntries(int depender_index, cmSystemTools::ExpandListArgument(value, deplist); // Look for entries meant for this configuration. - std::vector<std::string> actual_libs; + std::vector<cmLinkItem> actual_libs; cmTarget::LinkLibraryType llt = cmTarget::GENERAL; bool haveLLT = false; for(std::vector<std::string>::const_iterator di = deplist.begin(); @@ -522,11 +518,13 @@ void cmComputeLinkDepends::AddVarLinkEntries(int depender_index, // If the library is meant for this link type then use it. if(llt == cmTarget::GENERAL || llt == this->LinkType) { - actual_libs.push_back(*di); + cmLinkItem item(*di, this->FindTargetToLink(depender_index, *di)); + actual_libs.push_back(item); } else if(this->OldLinkDirMode) { - this->CheckWrongConfigItem(depender_index, *di); + cmLinkItem item(*di, this->FindTargetToLink(depender_index, *di)); + this->CheckWrongConfigItem(item); } // Reset the link type until another explicit type is given. @@ -544,38 +542,38 @@ void cmComputeLinkDepends::AddDirectLinkEntries() { // Add direct link dependencies in this configuration. cmTarget::LinkImplementation const* impl = - this->Target->GetLinkImplementation(this->Config, this->HeadTarget); + this->Target->GetLinkImplementation(this->Config); this->AddLinkEntries(-1, impl->Libraries); - for(std::vector<std::string>::const_iterator + for(std::vector<cmLinkItem>::const_iterator wi = impl->WrongConfigLibraries.begin(); wi != impl->WrongConfigLibraries.end(); ++wi) { - this->CheckWrongConfigItem(-1, *wi); + this->CheckWrongConfigItem(*wi); } } //---------------------------------------------------------------------------- void -cmComputeLinkDepends::AddLinkEntries(int depender_index, - std::vector<std::string> const& libs) +cmComputeLinkDepends::AddLinkEntries( + int depender_index, std::vector<cmLinkItem> const& libs) { // Track inferred dependency sets implied by this list. std::map<int, DependSet> dependSets; // Loop over the libraries linked directly by the depender. - for(std::vector<std::string>::const_iterator li = libs.begin(); + for(std::vector<cmLinkItem>::const_iterator li = libs.begin(); li != libs.end(); ++li) { // Skip entries that will resolve to the target getting linked or // are empty. - std::string item = this->Target->CheckCMP0004(*li); + cmLinkItem const& item = *li; if(item == this->Target->GetName() || item.empty()) { continue; } // Add a link entry for this item. - int dependee_index = this->AddLinkEntry(depender_index, item); + int dependee_index = this->AddLinkEntry(*li); // The dependee must come after the depender. if(depender_index >= 0) @@ -625,40 +623,15 @@ cmTarget const* cmComputeLinkDepends::FindTargetToLink(int depender_index, const std::string& name) { // Look for a target in the scope of the depender. - cmMakefile* mf = this->Makefile; + cmTarget const* from = this->Target; if(depender_index >= 0) { if(cmTarget const* depender = this->EntryList[depender_index].Target) { - mf = depender->GetMakefile(); + from = depender; } } - cmTarget const* tgt = mf->FindTargetToUse(name); - - // Skip targets that will not really be linked. This is probably a - // name conflict between an external library and an executable - // within the project. - if(tgt && tgt->GetType() == cmTarget::EXECUTABLE && - !tgt->IsExecutableWithExports()) - { - tgt = 0; - } - - if(tgt && tgt->GetType() == cmTarget::OBJECT_LIBRARY) - { - cmOStringStream e; - e << "Target \"" << this->Target->GetName() << "\" links to " - "OBJECT library \"" << tgt->GetName() << "\" but this is not " - "allowed. " - "One may link only to STATIC or SHARED libraries, or to executables " - "with the ENABLE_EXPORTS property set."; - this->CMakeInstance->IssueMessage(cmake::FATAL_ERROR, e.str(), - this->Target->GetBacktrace()); - tgt = 0; - } - - // Return the target found, if any. - return tgt; + return from->FindTargetToLink(name); } //---------------------------------------------------------------------------- @@ -955,7 +928,7 @@ int cmComputeLinkDepends::ComputeComponentCount(NodeList const& nl) if(cmTarget const* target = this->EntryList[*ni].Target) { if(cmTarget::LinkInterface const* iface = - target->GetLinkInterface(this->Config, this->HeadTarget)) + target->GetLinkInterface(this->Config, this->Target)) { if(iface->Multiplicity > count) { @@ -988,8 +961,7 @@ void cmComputeLinkDepends::DisplayFinalEntries() } //---------------------------------------------------------------------------- -void cmComputeLinkDepends::CheckWrongConfigItem(int depender_index, - std::string const& item) +void cmComputeLinkDepends::CheckWrongConfigItem(cmLinkItem const& item) { if(!this->OldLinkDirMode) { @@ -999,12 +971,8 @@ void cmComputeLinkDepends::CheckWrongConfigItem(int depender_index, // For CMake 2.4 bug-compatibility we need to consider the output // directories of targets linked in another configuration as link // directories. - if(cmTarget const* tgt - = this->FindTargetToLink(depender_index, item)) + if(item.Target && !item.Target->IsImported()) { - if(!tgt->IsImported()) - { - this->OldWrongConfigItems.insert(tgt); - } + this->OldWrongConfigItems.insert(item.Target); } } diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index 13fc993..3207ecb 100644 --- a/Source/cmComputeLinkDepends.h +++ b/Source/cmComputeLinkDepends.h @@ -32,8 +32,7 @@ class cmake; class cmComputeLinkDepends { public: - cmComputeLinkDepends(cmTarget const* target, const std::string& config, - cmTarget const* head); + cmComputeLinkDepends(cmTarget const* target, const std::string& config); ~cmComputeLinkDepends(); // Basic information about each link item. @@ -60,7 +59,6 @@ private: // Context information. cmTarget const* Target; - cmTarget const* HeadTarget; cmMakefile* Makefile; cmLocalGenerator* LocalGenerator; cmGlobalGenerator const* GlobalGenerator; @@ -79,11 +77,11 @@ private: std::map<std::string, int>::iterator AllocateLinkEntry(std::string const& item); - int AddLinkEntry(int depender_index, std::string const& item); + int AddLinkEntry(cmLinkItem const& item); void AddVarLinkEntries(int depender_index, const char* value); void AddDirectLinkEntries(); void AddLinkEntries(int depender_index, - std::vector<std::string> const& libs); + std::vector<cmLinkItem> const& libs); cmTarget const* FindTargetToLink(int depender_index, const std::string& name); @@ -105,7 +103,7 @@ private: // of the interface. struct SharedDepEntry { - std::string Item; + cmLinkItem Item; int DependerIndex; }; std::queue<SharedDepEntry> SharedDepQueue; @@ -114,7 +112,7 @@ private: cmTarget::LinkInterface const* iface, bool follow_interface = false); void QueueSharedDependencies(int depender_index, - std::vector<std::string> const& deps); + std::vector<cmLinkItem> const& deps); void HandleSharedDependency(SharedDepEntry const& dep); // Dependency inferral for each link item. @@ -165,7 +163,7 @@ private: // Compatibility help. bool OldLinkDirMode; - void CheckWrongConfigItem(int depender_index, std::string const& item); + void CheckWrongConfigItem(cmLinkItem const& item); std::set<cmTarget const*> OldWrongConfigItems; }; diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 0ce04a5..e1852a3 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -239,12 +239,10 @@ because this need be done only for shared libraries without soname-s. //---------------------------------------------------------------------------- cmComputeLinkInformation -::cmComputeLinkInformation(cmTarget const* target, const std::string& config, - cmTarget const* headTarget) +::cmComputeLinkInformation(cmTarget const* target, const std::string& config) { // Store context information. this->Target = target; - this->HeadTarget = headTarget; this->Makefile = this->Target->GetMakefile(); this->LocalGenerator = this->Makefile->GetLocalGenerator(); this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator(); @@ -267,7 +265,7 @@ cmComputeLinkInformation this->OrderDependentRPath = 0; // Get the language used for linking this target. - this->LinkLanguage = this->Target->GetLinkerLanguage(config, headTarget); + this->LinkLanguage = this->Target->GetLinkerLanguage(config); if(this->LinkLanguage.empty()) { // The Compute method will do nothing, so skip the rest of the @@ -505,8 +503,7 @@ bool cmComputeLinkInformation::Compute() } // Compute the ordered link line items. - cmComputeLinkDepends cld(this->Target, this->Config, - this->HeadTarget); + cmComputeLinkDepends cld(this->Target, this->Config); cld.SetOldLinkDirMode(this->OldLinkDirMode); cmComputeLinkDepends::EntryVector const& linkEntries = cld.Compute(); @@ -572,8 +569,7 @@ bool cmComputeLinkInformation::Compute() void cmComputeLinkInformation::AddImplicitLinkInfo() { // The link closure lists all languages whose implicit info is needed. - cmTarget::LinkClosure const* lc=this->Target->GetLinkClosure(this->Config, - this->HeadTarget); + cmTarget::LinkClosure const* lc=this->Target->GetLinkClosure(this->Config); for(std::vector<std::string>::const_iterator li = lc->Languages.begin(); li != lc->Languages.end(); ++li) { @@ -1972,7 +1968,7 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs, // present. This is done even when skipping rpath support. { cmTarget::LinkClosure const* lc = - this->Target->GetLinkClosure(this->Config, this->HeadTarget); + this->Target->GetLinkClosure(this->Config); for(std::vector<std::string>::const_iterator li = lc->Languages.begin(); li != lc->Languages.end(); ++li) { diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index e345fe2..e5d674a 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -29,8 +29,7 @@ class cmOrderDirectories; class cmComputeLinkInformation { public: - cmComputeLinkInformation(cmTarget const* target, const std::string& config, - cmTarget const* headTarget); + cmComputeLinkInformation(cmTarget const* target, const std::string& config); ~cmComputeLinkInformation(); bool Compute(); @@ -75,7 +74,6 @@ private: // Context information. cmTarget const* Target; - cmTarget const* HeadTarget; cmMakefile* Makefile; cmLocalGenerator* LocalGenerator; cmGlobalGenerator* GlobalGenerator; diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index f28217f..3929af4 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -249,20 +249,21 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) const_cast<cmTarget*>(depender)->AddUtility(objLib); } } - std::vector<std::string> tlibs; - depender->GetDirectLinkLibraries(*it, tlibs, depender); + + cmTarget::LinkImplementation const* impl = + depender->GetLinkImplementation(*it); // A target should not depend on itself. emitted.insert(depender->GetName()); - for(std::vector<std::string>::const_iterator lib = tlibs.begin(); - lib != tlibs.end(); ++lib) + for(std::vector<cmLinkItem>::const_iterator + lib = impl->Libraries.begin(); + lib != impl->Libraries.end(); ++lib) { // Don't emit the same library twice for this target. if(emitted.insert(*lib).second) { this->AddTargetDepend(depender_index, *lib, true); - this->AddInterfaceDepends(depender_index, *lib, - true, emitted); + this->AddInterfaceDepends(depender_index, *lib, emitted); } } } @@ -270,11 +271,11 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) // Loop over all utility dependencies. { - std::set<std::string> const& tutils = depender->GetUtilities(); + std::set<cmLinkItem> const& tutils = depender->GetUtilityItems(); std::set<std::string> emitted; // A target should not depend on itself. emitted.insert(depender->GetName()); - for(std::set<std::string>::const_iterator util = tutils.begin(); + for(std::set<cmLinkItem>::const_iterator util = tutils.begin(); util != tutils.end(); ++util) { // Don't emit the same utility twice for this target. @@ -296,7 +297,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, if(cmTarget::LinkInterface const* iface = dependee->GetLinkInterface(config, depender)) { - for(std::vector<std::string>::const_iterator + for(std::vector<cmLinkItem>::const_iterator lib = iface->Libraries.begin(); lib != iface->Libraries.end(); ++lib) { @@ -304,8 +305,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, if(emitted.insert(*lib).second) { this->AddTargetDepend(depender_index, *lib, true); - this->AddInterfaceDepends(depender_index, *lib, - true, emitted); + this->AddInterfaceDepends(depender_index, *lib, emitted); } } } @@ -313,17 +313,15 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, //---------------------------------------------------------------------------- void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, - const std::string& dependee_name, - bool linking, + cmLinkItem const& dependee_name, std::set<std::string> &emitted) { cmTarget const* depender = this->Targets[depender_index]; - cmTarget const* dependee = - depender->GetMakefile()->FindTargetToUse(dependee_name); + cmTarget const* dependee = dependee_name.Target; // Skip targets that will not really be linked. This is probably a // name conflict between an external library and an executable // within the project. - if(linking && dependee && + if(dependee && dependee->GetType() == cmTarget::EXECUTABLE && !dependee->IsExecutableWithExports()) { @@ -347,16 +345,15 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, } //---------------------------------------------------------------------------- -void cmComputeTargetDepends::AddTargetDepend(int depender_index, - const std::string& dependee_name, - bool linking) +void cmComputeTargetDepends::AddTargetDepend( + int depender_index, cmLinkItem const& dependee_name, + bool linking) { // Get the depender. cmTarget const* depender = this->Targets[depender_index]; // Check the target's makefile first. - cmTarget const* dependee = - depender->GetMakefile()->FindTargetToUse(dependee_name); + cmTarget const* dependee = dependee_name.Target; if(!dependee && !linking && (depender->GetType() != cmTarget::GLOBAL_TARGET)) @@ -424,12 +421,11 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, if(dependee->IsImported()) { // Skip imported targets but follow their utility dependencies. - std::set<std::string> const& utils = dependee->GetUtilities(); - for(std::set<std::string>::const_iterator i = utils.begin(); + std::set<cmLinkItem> const& utils = dependee->GetUtilityItems(); + for(std::set<cmLinkItem>::const_iterator i = utils.begin(); i != utils.end(); ++i) { - if(cmTarget const* transitive_dependee = - dependee->GetMakefile()->FindTargetToUse(*i)) + if(cmTarget const* transitive_dependee = i->Target) { this->AddTargetDepend(depender_index, transitive_dependee, false); } diff --git a/Source/cmComputeTargetDepends.h b/Source/cmComputeTargetDepends.h index 7553816..902f342 100644 --- a/Source/cmComputeTargetDepends.h +++ b/Source/cmComputeTargetDepends.h @@ -20,6 +20,7 @@ class cmComputeComponentGraph; class cmGlobalGenerator; +class cmLinkItem; class cmTarget; class cmTargetDependSet; @@ -46,14 +47,14 @@ private: void CollectDepends(); void CollectTargetDepends(int depender_index); void AddTargetDepend(int depender_index, - const std::string& dependee_name, + cmLinkItem const& dependee_name, bool linking); void AddTargetDepend(int depender_index, cmTarget const* dependee, bool linking); bool ComputeFinalDepends(cmComputeComponentGraph const& ccg); void AddInterfaceDepends(int depender_index, - const std::string& dependee_name, - bool linking, std::set<std::string> &emitted); + cmLinkItem const& dependee_name, + std::set<std::string> &emitted); void AddInterfaceDepends(int depender_index, cmTarget const* dependee, const std::string& config, std::set<std::string> &emitted); diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 79cb560..f06971d 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -765,7 +765,11 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, const char* compilerId) { /* - gnu: + gnu >= 4.9: + A mod file is an ascii file compressed with gzip. + Compiling twice produces identical modules. + + gnu < 4.9: A mod file is an ascii file. <bar.mod> FORTRAN module created from /path/to/foo.f90 on Sun Dec 30 22:47:58 2007 @@ -821,21 +825,30 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, */ if (strcmp(compilerId, "GNU") == 0 ) { - const char seq[1] = {'\n'}; - const int seqlen = 1; - - if(!cmDependsFortranStreamContainsSequence(finModFile, seq, seqlen)) + // GNU Fortran 4.9 and later compress .mod files with gzip + // but also do not include a date so we can fall through to + // compare them without skipping any prefix. + unsigned char hdr[2]; + bool okay = finModFile.read(reinterpret_cast<char*>(hdr), 2)? true:false; + finModFile.seekg(0); + if(!(okay && hdr[0] == 0x1f && hdr[1] == 0x8b)) { - // The module is of unexpected format. Assume it is different. - std::cerr << compilerId << " fortran module " << modFile - << " has unexpected format." << std::endl; - return true; - } + const char seq[1] = {'\n'}; + const int seqlen = 1; - if(!cmDependsFortranStreamContainsSequence(finStampFile, seq, seqlen)) - { - // The stamp must differ if the sequence is not contained. - return true; + if(!cmDependsFortranStreamContainsSequence(finModFile, seq, seqlen)) + { + // The module is of unexpected format. Assume it is different. + std::cerr << compilerId << " fortran module " << modFile + << " has unexpected format." << std::endl; + return true; + } + + if(!cmDependsFortranStreamContainsSequence(finStampFile, seq, seqlen)) + { + // The stamp must differ if the sequence is not contained. + return true; + } } } else if(strcmp(compilerId, "Intel") == 0) diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 9f5eee5..1f39d7a 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -865,15 +865,16 @@ cmExportFileGenerator } //---------------------------------------------------------------------------- +template <typename T> void cmExportFileGenerator ::SetImportLinkProperty(std::string const& suffix, cmTarget* target, const std::string& propName, - std::vector<std::string> const& entries, + std::vector<T> const& entries, ImportPropertyMap& properties, std::vector<std::string>& missingTargets - ) + ) { // Skip the property if there are no entries. if(entries.empty()) @@ -884,7 +885,7 @@ cmExportFileGenerator // Construct the property value. std::string link_entries; const char* sep = ""; - for(std::vector<std::string>::const_iterator li = entries.begin(); + for(typename std::vector<T>::const_iterator li = entries.begin(); li != entries.end(); ++li) { // Separate this from the previous entry. @@ -902,7 +903,6 @@ cmExportFileGenerator properties[prop] = link_entries; } - //---------------------------------------------------------------------------- void cmExportFileGenerator::GenerateImportHeaderCode(std::ostream& os, const std::string& config) diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index abd8ad5..919924e 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -95,9 +95,11 @@ protected: std::string const& suffix, cmTarget* target, ImportPropertyMap& properties, std::vector<std::string>& missingTargets); + + template <typename T> void SetImportLinkProperty(std::string const& suffix, cmTarget* target, const std::string& propName, - std::vector<std::string> const& entries, + std::vector<T> const& entries, ImportPropertyMap& properties, std::vector<std::string>& missingTargets); diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 6f76dc4..56a6edb 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -574,7 +574,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, } } - const char* buildType = makefile->GetDefinition("CMAKE_BUILD_TYPE"); + std::string buildType = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); std::string location; if ( target->GetType()==cmTarget::OBJECT_LIBRARY) { diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index e23551e..1beb3fd 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -968,7 +968,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const continue; } std::vector<std::string> includeDirs; - const char *config = mf->GetDefinition("CMAKE_BUILD_TYPE"); + std::string config = mf->GetSafeDefinition("CMAKE_BUILD_TYPE"); (*it)->GetIncludeDirectories(includeDirs, l->second, "C", config); this->AppendIncludeDirectories(fout, includeDirs, emmited); } diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 7dcb335..c925869 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -799,7 +799,8 @@ static const char* targetPropertyTransitiveWhitelist[] = { #undef TRANSITIVE_PROPERTY_NAME -std::string getLinkedTargetsContent(const std::vector<cmTarget*> &targets, +std::string getLinkedTargetsContent( + std::vector<cmTarget const*> &targets, cmTarget const* target, cmTarget const* headTarget, cmGeneratorExpressionContext *context, @@ -810,7 +811,7 @@ std::string getLinkedTargetsContent(const std::vector<cmTarget*> &targets, std::string sep; std::string depString; - for (std::vector<cmTarget*>::const_iterator + for (std::vector<cmTarget const*>::const_iterator it = targets.begin(); it != targets.end(); ++it) { @@ -827,7 +828,7 @@ std::string getLinkedTargetsContent(const std::vector<cmTarget*> &targets, sep = ";"; } cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(depString); - std::string linkedTargetsContent = cge->Evaluate(context->Makefile, + std::string linkedTargetsContent = cge->Evaluate(target->GetMakefile(), context->Config, context->Quiet, headTarget, @@ -840,21 +841,21 @@ std::string getLinkedTargetsContent(const std::vector<cmTarget*> &targets, return linkedTargetsContent; } -std::string getLinkedTargetsContent(const std::vector<std::string> &libraries, +std::string getLinkedTargetsContent(std::vector<cmLinkItem> const &libraries, cmTarget const* target, cmTarget const* headTarget, cmGeneratorExpressionContext *context, cmGeneratorExpressionDAGChecker *dagChecker, const std::string &interfacePropertyName) { - std::vector<cmTarget*> tgts; - for (std::vector<std::string>::const_iterator + std::vector<cmTarget const*> tgts; + for (std::vector<cmLinkItem>::const_iterator it = libraries.begin(); it != libraries.end(); ++it) { - if (cmTarget *tgt = context->Makefile->FindTargetToUse(*it)) + if (it->Target) { - tgts.push_back(tgt); + tgts.push_back(it->Target); } } return getLinkedTargetsContent(tgts, target, headTarget, context, @@ -1082,7 +1083,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode cmStrCmp(propertyName)) != transEnd) { - std::vector<cmTarget*> tgts; + std::vector<cmTarget const*> tgts; target->GetTransitivePropertyTargets(context->Config, headTarget, tgts); if (!tgts.empty()) @@ -1098,8 +1099,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode cmStrCmp(interfacePropertyName)) != transEnd) { const cmTarget::LinkImplementation *impl - = target->GetLinkImplementationLibraries(context->Config, - headTarget); + = target->GetLinkImplementationLibraries(context->Config); if(impl) { linkedTargetsContent = diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index a7576ed..fd82d17 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -252,7 +252,7 @@ cmGeneratorTarget::GetSourceDepends(cmSourceFile const* sf) const return 0; } -static void handleSystemIncludesDep(cmMakefile *mf, cmTarget* depTgt, +static void handleSystemIncludesDep(cmMakefile *mf, cmTarget const* depTgt, const std::string& config, cmTarget *headTarget, cmGeneratorExpressionDAGChecker *dagChecker, @@ -449,7 +449,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir, if (iter == this->SystemIncludesCache.end()) { cmTarget::LinkImplementation const* impl - = this->Target->GetLinkImplementation(config, this->Target); + = this->Target->GetLinkImplementation(config); if(!impl) { return false; @@ -474,11 +474,11 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir, &dagChecker), result); } - std::set<cmTarget*> uniqueDeps; - for(std::vector<std::string>::const_iterator li = impl->Libraries.begin(); + std::set<cmTarget const*> uniqueDeps; + for(std::vector<cmLinkItem>::const_iterator li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li) { - cmTarget* tgt = this->Makefile->FindTargetToUse(*li); + cmTarget const* tgt = li->Target; if (!tgt) { continue; @@ -489,10 +489,10 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir, handleSystemIncludesDep(this->Makefile, tgt, config, this->Target, &dagChecker, result, excludeImported); - std::vector<cmTarget*> deps; + std::vector<cmTarget const*> deps; tgt->GetTransitivePropertyTargets(config, this->Target, deps); - for(std::vector<cmTarget*>::const_iterator di = deps.begin(); + for(std::vector<cmTarget const*>::const_iterator di = deps.begin(); di != deps.end(); ++di) { if (uniqueDeps.insert(*di).second) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 29a5955..9a36df5 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1255,7 +1255,7 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmTarget& cmtarget) // If the language is compiled as a source trust Xcode to link with it. cmTarget::LinkImplementation const* impl = - cmtarget.GetLinkImplementation("NOCONFIG", &cmtarget); + cmtarget.GetLinkImplementation("NOCONFIG"); for(std::vector<std::string>::const_iterator li = impl->Languages.begin(); li != impl->Languages.end(); ++li) { diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index a1dbaa5..5380d06 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1861,7 +1861,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, ((useWatcomQuote) ? WATCOMQUOTE : SHELL); bool escapeAllowMakeVars = !forResponseFile; cmOStringStream fout; - const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); + std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); cmComputeLinkInformation* pcli = tgt.Target->GetLinkInformation(config); if(!pcli) { diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 01edde9..71d03df 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -64,11 +64,16 @@ struct cmTarget::OutputInfo //---------------------------------------------------------------------------- struct cmTarget::ImportInfo { + ImportInfo(): NoSOName(false), Multiplicity(0) {} bool NoSOName; + int Multiplicity; std::string Location; std::string SOName; std::string ImportLibrary; - cmTarget::LinkInterface LinkInterface; + std::string Languages; + std::string Libraries; + std::string LibrariesProp; + std::string SharedDeps; }; //---------------------------------------------------------------------------- @@ -90,11 +95,13 @@ public: : Backtrace(NULL) { this->PolicyWarnedCMP0022 = false; + this->UtilityItemsDone = false; } cmTargetInternals(cmTargetInternals const&) : Backtrace(NULL) { this->PolicyWarnedCMP0022 = false; + this->UtilityItemsDone = false; } ~cmTargetInternals(); @@ -121,11 +128,14 @@ public: LinkInterfaceMapType LinkInterfaceMap; bool PolicyWarnedCMP0022; + typedef std::map<TargetConfigPair, cmTarget::LinkInterface> + ImportLinkInterfaceMapType; + ImportLinkInterfaceMapType ImportLinkInterfaceMap; + typedef std::map<std::string, cmTarget::OutputInfo> OutputInfoMapType; OutputInfoMapType OutputInfoMap; - typedef std::map<TargetConfigPair, cmTarget::ImportInfo> - ImportInfoMapType; + typedef std::map<std::string, cmTarget::ImportInfo> ImportInfoMapType; ImportInfoMapType ImportInfoMap; typedef std::map<std::string, cmTarget::CompileInfo> CompileInfoMapType; @@ -136,14 +146,16 @@ public: cmTarget::LinkImplementation> LinkImplMapType; LinkImplMapType LinkImplMap; - typedef std::map<TargetConfigPair, cmTarget::LinkClosure> - LinkClosureMapType; + typedef std::map<std::string, cmTarget::LinkClosure> LinkClosureMapType; LinkClosureMapType LinkClosureMap; typedef std::map<TargetConfigPair, std::vector<cmSourceFile*> > SourceFilesMapType; SourceFilesMapType SourceFilesMap; + std::set<cmLinkItem> UtilityItems; + bool UtilityItemsDone; + struct TargetPropertyEntry { TargetPropertyEntry(cmsys::auto_ptr<cmCompiledGeneratorExpression> cge, const std::string &targetName = std::string()) @@ -170,12 +182,15 @@ public: CachedLinkInterfaceSourcesEntries; mutable std::map<std::string, std::vector<TargetPropertyEntry*> > CachedLinkInterfaceCompileFeaturesEntries; + mutable std::map<std::string, std::vector<cmTarget const*> > + CachedLinkImplementationClosure; mutable std::map<std::string, bool> CacheLinkInterfaceIncludeDirectoriesDone; mutable std::map<std::string, bool> CacheLinkInterfaceCompileDefinitionsDone; mutable std::map<std::string, bool> CacheLinkInterfaceCompileOptionsDone; mutable std::map<std::string, bool> CacheLinkInterfaceSourcesDone; mutable std::map<std::string, bool> CacheLinkInterfaceCompileFeaturesDone; + mutable std::map<std::string, bool> CacheLinkImplementationClosureDone; }; //---------------------------------------------------------------------------- @@ -461,6 +476,22 @@ cmListFileBacktrace const* cmTarget::GetUtilityBacktrace( } //---------------------------------------------------------------------------- +std::set<cmLinkItem> const& cmTarget::GetUtilityItems() const +{ + if(!this->Internal->UtilityItemsDone) + { + this->Internal->UtilityItemsDone = true; + for(std::set<std::string>::const_iterator i = this->Utilities.begin(); + i != this->Utilities.end(); ++i) + { + this->Internal->UtilityItems.insert( + cmLinkItem(*i, this->Makefile->FindTargetToUse(*i))); + } + } + return this->Internal->UtilityItems; +} + +//---------------------------------------------------------------------------- void cmTarget::FinishConfigure() { // Erase any cached link information that might have been comptued @@ -479,6 +510,7 @@ void cmTarget::ClearLinkMaps() this->LinkImplementationLanguageIsContextDependent = true; this->Internal->LinkImplMap.clear(); this->Internal->LinkInterfaceMap.clear(); + this->Internal->ImportLinkInterfaceMap.clear(); this->Internal->LinkClosureMap.clear(); for (cmTargetLinkInformationMap::const_iterator it = this->LinkInformation.begin(); @@ -1195,63 +1227,6 @@ bool cmTarget::NameResolvesToFramework(const std::string& libname) const } //---------------------------------------------------------------------------- -void cmTarget::GetDirectLinkLibraries(const std::string& config, - std::vector<std::string> &libs, - cmTarget const* head) const -{ - const char *prop = this->GetProperty("LINK_LIBRARIES"); - if (prop) - { - cmGeneratorExpression ge; - const cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop); - - cmGeneratorExpressionDAGChecker dagChecker( - this->GetName(), - "LINK_LIBRARIES", 0, 0); - cmSystemTools::ExpandListArgument(cge->Evaluate(this->Makefile, - config, - false, - head, - &dagChecker), - libs); - - std::set<std::string> const& seenProps = cge->GetSeenTargetProperties(); - for (std::set<std::string>::const_iterator it = seenProps.begin(); - it != seenProps.end(); ++it) - { - if (!this->GetProperty(*it)) - { - this->LinkImplicitNullProperties.insert(*it); - } - } - cge->GetMaxLanguageStandard(this, this->MaxLanguageStandards); - } -} - -//---------------------------------------------------------------------------- -void cmTarget::GetInterfaceLinkLibraries(const std::string& config, - std::vector<std::string> &libs, - cmTarget const* head) const -{ - const char *prop = this->GetProperty("INTERFACE_LINK_LIBRARIES"); - if (prop) - { - cmGeneratorExpression ge; - const cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop); - - cmGeneratorExpressionDAGChecker dagChecker( - this->GetName(), - "INTERFACE_LINK_LIBRARIES", 0, 0); - cmSystemTools::ExpandListArgument(cge->Evaluate(this->Makefile, - config, - false, - head, - &dagChecker), - libs); - } -} - -//---------------------------------------------------------------------------- std::string cmTarget::GetDebugGeneratorExpressions(const std::string &value, cmTarget::LinkLibraryType llt) const { @@ -2294,9 +2269,8 @@ cmTarget::GetIncludeDirectories(const std::string& config) const if(this->Makefile->IsOn("APPLE")) { - LinkImplementation const* impl = this->GetLinkImplementation(config, - this); - for(std::vector<std::string>::const_iterator + LinkImplementation const* impl = this->GetLinkImplementation(config); + for(std::vector<cmLinkItem>::const_iterator it = impl->Libraries.begin(); it != impl->Libraries.end(); ++it) { @@ -3498,13 +3472,11 @@ public: Makefile(target->GetMakefile()), Target(target) { this->Visited.insert(target); } - void Visit(const std::string& name) + void Visit(cmLinkItem const& item) { - cmTarget *target = this->Makefile->FindTargetToUse(name); - - if(!target) + if(!item.Target) { - if(name.find("::") != std::string::npos) + if(item.find("::") != std::string::npos) { bool noMessage = false; cmake::MessageType messageType = cmake::FATAL_ERROR; @@ -3530,7 +3502,7 @@ public: if(!noMessage) { e << "Target \"" << this->Target->GetName() - << "\" links to target \"" << name + << "\" links to target \"" << item << "\" but the target was not found. Perhaps a find_package() " "call is missing for an IMPORTED target, or an ALIAS target is " "missing?"; @@ -3541,13 +3513,13 @@ public: } return; } - if(!this->Visited.insert(target).second) + if(!this->Visited.insert(item.Target).second) { return; } cmTarget::LinkInterface const* iface = - target->GetLinkInterface(this->Config, this->HeadTarget); + item.Target->GetLinkInterface(this->Config, this->HeadTarget); if(!iface) { return; } for(std::vector<std::string>::const_iterator @@ -3556,7 +3528,7 @@ public: this->Languages.insert(*li); } - for(std::vector<std::string>::const_iterator + for(std::vector<cmLinkItem>::const_iterator li = iface->Libraries.begin(); li != iface->Libraries.end(); ++li) { this->Visit(*li); @@ -3572,25 +3544,22 @@ private: }; //---------------------------------------------------------------------------- -std::string cmTarget::GetLinkerLanguage(const std::string& config, - cmTarget const* head) const +std::string cmTarget::GetLinkerLanguage(const std::string& config) const { - cmTarget const* headTarget = head ? head : this; - return this->GetLinkClosure(config, headTarget)->LinkerLanguage; + return this->GetLinkClosure(config)->LinkerLanguage; } //---------------------------------------------------------------------------- -cmTarget::LinkClosure const* cmTarget::GetLinkClosure( - const std::string& config, - cmTarget const* head) const +cmTarget::LinkClosure const* +cmTarget::GetLinkClosure(const std::string& config) const { - TargetConfigPair key(head, cmSystemTools::UpperCase(config)); + std::string key(cmSystemTools::UpperCase(config)); cmTargetInternals::LinkClosureMapType::iterator i = this->Internal->LinkClosureMap.find(key); if(i == this->Internal->LinkClosureMap.end()) { LinkClosure lc; - this->ComputeLinkClosure(config, lc, head); + this->ComputeLinkClosure(config, lc); cmTargetInternals::LinkClosureMapType::value_type entry(key, lc); i = this->Internal->LinkClosureMap.insert(entry).first; } @@ -3651,12 +3620,12 @@ public: }; //---------------------------------------------------------------------------- -void cmTarget::ComputeLinkClosure(const std::string& config, LinkClosure& lc, - cmTarget const* head) const +void cmTarget::ComputeLinkClosure(const std::string& config, + LinkClosure& lc) const { // Get languages built in this target. std::set<std::string> languages; - LinkImplementation const* impl = this->GetLinkImplementation(config, head); + LinkImplementation const* impl = this->GetLinkImplementation(config); for(std::vector<std::string>::const_iterator li = impl->Languages.begin(); li != impl->Languages.end(); ++li) { @@ -3664,8 +3633,8 @@ void cmTarget::ComputeLinkClosure(const std::string& config, LinkClosure& lc, } // Add interface languages from linked targets. - cmTargetCollectLinkLanguages cll(this, config, languages, head); - for(std::vector<std::string>::const_iterator li = impl->Libraries.begin(); + cmTargetCollectLinkLanguages cll(this, config, languages, this); + for(std::vector<cmLinkItem>::const_iterator li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li) { cll.Visit(*li); @@ -3715,6 +3684,41 @@ void cmTarget::ComputeLinkClosure(const std::string& config, LinkClosure& lc, } //---------------------------------------------------------------------------- +void cmTarget::ExpandLinkItems(std::string const& prop, + std::string const& value, + std::string const& config, + cmTarget const* headTarget, + std::vector<cmLinkItem>& items) const +{ + cmGeneratorExpression ge; + cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), prop, 0, 0); + std::vector<std::string> libs; + cmSystemTools::ExpandListArgument(ge.Parse(value)->Evaluate( + this->Makefile, + config, + false, + headTarget, + this, &dagChecker), libs); + this->LookupLinkItems(libs, items); +} + +//---------------------------------------------------------------------------- +void cmTarget::LookupLinkItems(std::vector<std::string> const& names, + std::vector<cmLinkItem>& items) const +{ + for(std::vector<std::string>::const_iterator i = names.begin(); + i != names.end(); ++i) + { + std::string name = this->CheckCMP0004(*i); + if(name == this->GetName() || name.empty()) + { + continue; + } + items.push_back(cmLinkItem(name, this->FindTargetToLink(name))); + } +} + +//---------------------------------------------------------------------------- const char* cmTarget::GetSuffixVariableInternal(bool implib) const { switch(this->GetType()) @@ -3845,8 +3849,7 @@ bool cmTarget::HasSOName(const std::string& config) const return ((this->GetType() == cmTarget::SHARED_LIBRARY || this->GetType() == cmTarget::MODULE_LIBRARY) && !this->GetPropertyAsBool("NO_SONAME") && - this->Makefile->GetSONameFlag(this->GetLinkerLanguage(config, - this))); + this->Makefile->GetSONameFlag(this->GetLinkerLanguage(config))); } //---------------------------------------------------------------------------- @@ -3855,7 +3858,7 @@ std::string cmTarget::GetSOName(const std::string& config) const if(this->IsImported()) { // Lookup the imported soname. - if(cmTarget::ImportInfo const* info = this->GetImportInfo(config, this)) + if(cmTarget::ImportInfo const* info = this->GetImportInfo(config)) { if(info->NoSOName) { @@ -3923,7 +3926,7 @@ bool cmTarget::HasMacOSXRpathInstallNameDir(const std::string& config) const else { // Lookup the imported soname. - if(cmTarget::ImportInfo const* info = this->GetImportInfo(config, this)) + if(cmTarget::ImportInfo const* info = this->GetImportInfo(config)) { if(!info->NoSOName && !info->SOName.empty()) { @@ -4009,7 +4012,7 @@ bool cmTarget::IsImportedSharedLibWithoutSOName( { if(this->IsImported() && this->GetType() == cmTarget::SHARED_LIBRARY) { - if(cmTarget::ImportInfo const* info = this->GetImportInfo(config, this)) + if(cmTarget::ImportInfo const* info = this->GetImportInfo(config)) { return info->NoSOName; } @@ -4133,7 +4136,7 @@ std::string cmTarget::ImportedGetFullPath(const std::string& config, bool implib) const { std::string result; - if(cmTarget::ImportInfo const* info = this->GetImportInfo(config, this)) + if(cmTarget::ImportInfo const* info = this->GetImportInfo(config)) { result = implib? info->ImportLibrary : info->Location; } @@ -4219,7 +4222,7 @@ void cmTarget::GetFullNameInternal(const std::string& config, const char* suffixVar = this->GetSuffixVariableInternal(implib); // Check for language-specific default prefix and suffix. - std::string ll = this->GetLinkerLanguage(config, this); + std::string ll = this->GetLinkerLanguage(config); if(!ll.empty()) { if(!targetSuffix && suffixVar && *suffixVar) @@ -4507,9 +4510,12 @@ bool cmTarget::HaveBuildTreeRPATH(const std::string& config) const { return false; } - std::vector<std::string> libs; - this->GetDirectLinkLibraries(config, libs, this); - return !libs.empty(); + if(LinkImplementation const* impl = + this->GetLinkImplementationLibraries(config)) + { + return !impl->Libraries.empty(); + } + return false; } //---------------------------------------------------------------------------- @@ -4558,7 +4564,7 @@ bool cmTarget::NeedRelinkBeforeInstall(const std::string& config) const } // Check for rpath support on this platform. - std::string ll = this->GetLinkerLanguage(config, this); + std::string ll = this->GetLinkerLanguage(config); if(!ll.empty()) { std::string flagVar = "CMAKE_SHARED_LIBRARY_RUNTIME_"; @@ -5212,8 +5218,8 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, assert((impliedByUse ^ explicitlySet) || (!impliedByUse && !explicitlySet)); - std::vector<cmTarget*> deps; - tgt->GetTransitiveTargetClosure(config, tgt, deps); + std::vector<cmTarget const*> const& deps = + tgt->GetLinkImplementationClosure(config); if(deps.empty()) { @@ -5238,7 +5244,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, report += "\" property not set.\n"; } - for(std::vector<cmTarget*>::const_iterator li = + for(std::vector<cmTarget const*>::const_iterator li = deps.begin(); li != deps.end(); ++li) { @@ -5428,16 +5434,15 @@ bool isLinkDependentProperty(cmTarget const* tgt, const std::string &p, const std::string& interfaceProperty, const std::string& config) { - std::vector<cmTarget*> deps; - tgt->GetTransitiveTargetClosure(config, tgt, deps); + std::vector<cmTarget const*> const& deps = + tgt->GetLinkImplementationClosure(config); if(deps.empty()) { return false; } - for(std::vector<cmTarget*>::const_iterator li = - deps.begin(); + for(std::vector<cmTarget const*>::const_iterator li = deps.begin(); li != deps.end(); ++li) { const char *prop = (*li)->GetProperty(interfaceProperty); @@ -5647,7 +5652,7 @@ bool cmTarget::IsChrpathUsed(const std::string& config) const #if defined(CMAKE_USE_ELF_PARSER) // Enable if the rpath flag uses a separator and the target uses ELF // binaries. - std::string ll = this->GetLinkerLanguage(config, this); + std::string ll = this->GetLinkerLanguage(config); if(!ll.empty()) { std::string sepVar = "CMAKE_SHARED_LIBRARY_RUNTIME_"; @@ -5672,8 +5677,7 @@ bool cmTarget::IsChrpathUsed(const std::string& config) const //---------------------------------------------------------------------------- cmTarget::ImportInfo const* -cmTarget::GetImportInfo(const std::string& config, - cmTarget const* headTarget) const +cmTarget::GetImportInfo(const std::string& config) const { // There is no imported information for non-imported targets. if(!this->IsImported()) @@ -5692,16 +5696,15 @@ cmTarget::GetImportInfo(const std::string& config, { config_upper = "NOCONFIG"; } - TargetConfigPair key(headTarget, config_upper); typedef cmTargetInternals::ImportInfoMapType ImportInfoMapType; ImportInfoMapType::const_iterator i = - this->Internal->ImportInfoMap.find(key); + this->Internal->ImportInfoMap.find(config_upper); if(i == this->Internal->ImportInfoMap.end()) { ImportInfo info; - this->ComputeImportInfo(config_upper, info, headTarget); - ImportInfoMapType::value_type entry(key, info); + this->ComputeImportInfo(config_upper, info); + ImportInfoMapType::value_type entry(config_upper, info); i = this->Internal->ImportInfoMap.insert(entry).first; } @@ -5853,8 +5856,7 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config, //---------------------------------------------------------------------------- void cmTarget::ComputeImportInfo(std::string const& desired_config, - ImportInfo& info, - cmTarget const* headTarget) const + ImportInfo& info) const { // This method finds information about an imported target from its // properties. The "IMPORTED_" namespace is reserved for properties @@ -5893,19 +5895,8 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, } if(propertyLibs) { - cmGeneratorExpression ge; - - cmGeneratorExpressionDAGChecker dagChecker( - this->GetName(), - linkProp, 0, 0); - cmSystemTools::ExpandListArgument(ge.Parse(propertyLibs) - ->Evaluate(this->Makefile, - desired_config, - false, - headTarget, - this, - &dagChecker), - info.LinkInterface.Libraries); + info.LibrariesProp = linkProp; + info.Libraries = propertyLibs; } } if(this->GetType() == INTERFACE_LIBRARY) @@ -5991,13 +5982,12 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, linkProp += suffix; if(const char* config_libs = this->GetProperty(linkProp)) { - cmSystemTools::ExpandListArgument(config_libs, - info.LinkInterface.SharedDeps); + info.SharedDeps = config_libs; } else if(const char* libs = this->GetProperty("IMPORTED_LINK_DEPENDENT_LIBRARIES")) { - cmSystemTools::ExpandListArgument(libs, info.LinkInterface.SharedDeps); + info.SharedDeps = libs; } } @@ -6008,14 +5998,12 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, linkProp += suffix; if(const char* config_libs = this->GetProperty(linkProp)) { - cmSystemTools::ExpandListArgument(config_libs, - info.LinkInterface.Languages); + info.Languages = config_libs; } else if(const char* libs = this->GetProperty("IMPORTED_LINK_INTERFACE_LANGUAGES")) { - cmSystemTools::ExpandListArgument(libs, - info.LinkInterface.Languages); + info.Languages = libs; } } @@ -6026,12 +6014,12 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, linkProp += suffix; if(const char* config_reps = this->GetProperty(linkProp)) { - sscanf(config_reps, "%u", &info.LinkInterface.Multiplicity); + sscanf(config_reps, "%u", &info.Multiplicity); } else if(const char* reps = this->GetProperty("IMPORTED_LINK_INTERFACE_MULTIPLICITY")) { - sscanf(reps, "%u", &info.LinkInterface.Multiplicity); + sscanf(reps, "%u", &info.Multiplicity); } } } @@ -6044,11 +6032,7 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface( // Imported targets have their own link interface. if(this->IsImported()) { - if(cmTarget::ImportInfo const* info = this->GetImportInfo(config, head)) - { - return &info->LinkInterface; - } - return 0; + return this->GetImportLinkInterface(config, head); } // Link interfaces are not supported for executables that do not @@ -6097,11 +6081,7 @@ cmTarget::GetLinkInterfaceLibraries(const std::string& config, // Imported targets have their own link interface. if(this->IsImported()) { - if(cmTarget::ImportInfo const* info = this->GetImportInfo(config, head)) - { - return &info->LinkInterface; - } - return 0; + return this->GetImportLinkInterface(config, head); } // Link interfaces are not supported for executables that do not @@ -6135,53 +6115,90 @@ cmTarget::GetLinkInterfaceLibraries(const std::string& config, } //---------------------------------------------------------------------------- +cmTarget::LinkInterface const* +cmTarget::GetImportLinkInterface(const std::string& config, + cmTarget const* headTarget) const +{ + cmTarget::ImportInfo const* info = this->GetImportInfo(config); + if(!info) + { + return 0; + } + + TargetConfigPair key(headTarget, cmSystemTools::UpperCase(config)); + + cmTargetInternals::ImportLinkInterfaceMapType::iterator i = + this->Internal->ImportLinkInterfaceMap.find(key); + if(i == this->Internal->ImportLinkInterfaceMap.end()) + { + LinkInterface iface; + iface.Multiplicity = info->Multiplicity; + cmSystemTools::ExpandListArgument(info->Languages, iface.Languages); + this->ExpandLinkItems(info->LibrariesProp, info->Libraries, config, + headTarget, iface.Libraries); + { + std::vector<std::string> deps; + cmSystemTools::ExpandListArgument(info->SharedDeps, deps); + this->LookupLinkItems(deps, iface.SharedDeps); + } + + cmTargetInternals::ImportLinkInterfaceMapType::value_type + entry(key, iface); + i = this->Internal->ImportLinkInterfaceMap.insert(entry).first; + } + return &i->second; +} + +//---------------------------------------------------------------------------- void processILibs(const std::string& config, cmTarget const* headTarget, - std::string const& name, - std::vector<cmTarget*>& tgts, std::set<cmTarget*>& emitted) + cmLinkItem const& item, + std::vector<cmTarget const*>& tgts, + std::set<cmTarget const*>& emitted) { - if (cmTarget* tgt = headTarget->GetMakefile() - ->FindTargetToUse(name)) + if (item.Target && emitted.insert(item.Target).second) { - if (emitted.insert(tgt).second) + tgts.push_back(item.Target); + if(cmTarget::LinkInterface const* iface = + item.Target->GetLinkInterfaceLibraries(config, headTarget)) { - tgts.push_back(tgt); - cmTarget::LinkInterface const* iface = - tgt->GetLinkInterfaceLibraries(config, headTarget); - if (iface) - { - for(std::vector<std::string>::const_iterator + for(std::vector<cmLinkItem>::const_iterator it = iface->Libraries.begin(); - it != iface->Libraries.end(); ++it) - { - processILibs(config, headTarget, *it, tgts, emitted); - } + it != iface->Libraries.end(); ++it) + { + processILibs(config, headTarget, *it, tgts, emitted); } } } } //---------------------------------------------------------------------------- -void cmTarget::GetTransitiveTargetClosure(const std::string& config, - cmTarget const* headTarget, - std::vector<cmTarget*> &tgts) const +std::vector<cmTarget const*> const& +cmTarget::GetLinkImplementationClosure(const std::string& config) const { - std::set<cmTarget*> emitted; + std::vector<cmTarget const*>& tgts = + this->Internal->CachedLinkImplementationClosure[config]; + if(!this->Internal->CacheLinkImplementationClosureDone[config]) + { + this->Internal->CacheLinkImplementationClosureDone[config] = true; + std::set<cmTarget const*> emitted; - cmTarget::LinkImplementation const* impl - = this->GetLinkImplementationLibraries(config, headTarget); + cmTarget::LinkImplementation const* impl + = this->GetLinkImplementationLibraries(config); - for(std::vector<std::string>::const_iterator it = impl->Libraries.begin(); - it != impl->Libraries.end(); ++it) - { - processILibs(config, headTarget, *it, tgts, emitted); + for(std::vector<cmLinkItem>::const_iterator it = impl->Libraries.begin(); + it != impl->Libraries.end(); ++it) + { + processILibs(config, this, *it, tgts , emitted); + } } + return tgts; } //---------------------------------------------------------------------------- void cmTarget::GetTransitivePropertyTargets(const std::string& config, cmTarget const* headTarget, - std::vector<cmTarget*> &tgts) const + std::vector<cmTarget const*> &tgts) const { cmTarget::LinkInterface const* iface = this->GetLinkInterfaceLibraries(config, headTarget); @@ -6193,13 +6210,12 @@ void cmTarget::GetTransitivePropertyTargets(const std::string& config, || this->GetPolicyStatusCMP0022() == cmPolicies::WARN || this->GetPolicyStatusCMP0022() == cmPolicies::OLD) { - for(std::vector<std::string>::const_iterator it = iface->Libraries.begin(); + for(std::vector<cmLinkItem>::const_iterator it = iface->Libraries.begin(); it != iface->Libraries.end(); ++it) { - if (cmTarget* tgt = headTarget->GetMakefile() - ->FindTargetToUse(*it)) + if (it->Target) { - tgts.push_back(tgt); + tgts.push_back(it->Target); } } return; @@ -6229,8 +6245,7 @@ void cmTarget::GetTransitivePropertyTargets(const std::string& config, for(std::vector<std::string>::const_iterator it = libs.begin(); it != libs.end(); ++it) { - if (cmTarget* tgt = headTarget->GetMakefile() - ->FindTargetToUse(*it)) + if (cmTarget const* tgt = this->FindTargetToLink(*it)) { tgts.push_back(tgt); } @@ -6325,15 +6340,8 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config, if(explicitLibraries) { // The interface libraries have been explicitly set. - cmGeneratorExpression ge; - cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), - linkIfaceProp, 0, 0); - cmSystemTools::ExpandListArgument(ge.Parse(explicitLibraries)->Evaluate( - this->Makefile, - config, - false, - headTarget, - this, &dagChecker), iface.Libraries); + this->ExpandLinkItems(linkIfaceProp, explicitLibraries, config, + headTarget, iface.Libraries); } else if (this->PolicyStatusCMP0022 == cmPolicies::WARN || this->PolicyStatusCMP0022 == cmPolicies::OLD) @@ -6344,32 +6352,26 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config, { // The link implementation is the default link interface. LinkImplementation const* impl = - this->GetLinkImplementationLibraries(config, headTarget); + this->GetLinkImplementationLibrariesInternal(config, headTarget); iface.Libraries = impl->Libraries; if(this->PolicyStatusCMP0022 == cmPolicies::WARN && !this->Internal->PolicyWarnedCMP0022) { // Compare the link implementation fallback link interface to the // preferred new link interface property and warn if different. - cmGeneratorExpression ge; - cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), - "INTERFACE_LINK_LIBRARIES", 0, 0); - std::vector<std::string> ifaceLibs; - const char* newExplicitLibraries = - this->GetProperty("INTERFACE_LINK_LIBRARIES"); - cmSystemTools::ExpandListArgument( - ge.Parse(newExplicitLibraries)->Evaluate(this->Makefile, - config, - false, - headTarget, - this, &dagChecker), - ifaceLibs); + std::vector<cmLinkItem> ifaceLibs; + std::string newProp = "INTERFACE_LINK_LIBRARIES"; + if(const char* newExplicitLibraries = this->GetProperty(newProp)) + { + this->ExpandLinkItems(newProp, newExplicitLibraries, config, + headTarget, ifaceLibs); + } if (ifaceLibs != impl->Libraries) { std::string oldLibraries; std::string newLibraries; const char *sep = ""; - for(std::vector<std::string>::const_iterator it + for(std::vector<cmLinkItem>::const_iterator it = impl->Libraries.begin(); it != impl->Libraries.end(); ++it) { oldLibraries += sep; @@ -6377,7 +6379,7 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config, sep = ";"; } sep = ""; - for(std::vector<std::string>::const_iterator it + for(std::vector<cmLinkItem>::const_iterator it = ifaceLibs.begin(); it != ifaceLibs.end(); ++it) { newLibraries += sep; @@ -6428,7 +6430,7 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, // Shared libraries may have runtime implementation dependencies // on other shared libraries that are not in the interface. std::set<std::string> emitted; - for(std::vector<std::string>::const_iterator + for(std::vector<cmLinkItem>::const_iterator li = iface.Libraries.begin(); li != iface.Libraries.end(); ++li) { emitted.insert(*li); @@ -6436,16 +6438,16 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, if (thisTarget->GetType() != cmTarget::INTERFACE_LIBRARY) { cmTarget::LinkImplementation const* impl = - thisTarget->GetLinkImplementation(config, headTarget); - for(std::vector<std::string>::const_iterator + thisTarget->GetLinkImplementation(config); + for(std::vector<cmLinkItem>::const_iterator li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li) { if(emitted.insert(*li).second) { - if(cmTarget* tgt = thisTarget->Makefile->FindTargetToUse(*li)) + if(li->Target) { // This is a runtime dependency on another shared library. - if(tgt->GetType() == cmTarget::SHARED_LIBRARY) + if(li->Target->GetType() == cmTarget::SHARED_LIBRARY) { iface.SharedDeps.push_back(*li); } @@ -6467,7 +6469,8 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, { // The link implementation is the default link interface. cmTarget::LinkImplementation const* - impl = thisTarget->GetLinkImplementation(config, headTarget); + impl = thisTarget->GetLinkImplementationLibrariesInternal(config, + headTarget); iface.ImplementationIsInterface = true; iface.WrongConfigLibraries = impl->WrongConfigLibraries; } @@ -6476,7 +6479,7 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, { // Targets using this archive need its language runtime libraries. if(cmTarget::LinkImplementation const* impl = - thisTarget->GetLinkImplementation(config, headTarget)) + thisTarget->GetLinkImplementation(config)) { iface.Languages = impl->Languages; } @@ -6514,8 +6517,7 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, //---------------------------------------------------------------------------- cmTarget::LinkImplementation const* -cmTarget::GetLinkImplementation(const std::string& config, - cmTarget const* head) const +cmTarget::GetLinkImplementation(const std::string& config) const { // There is no link implementation for imported targets. if(this->IsImported()) @@ -6524,7 +6526,7 @@ cmTarget::GetLinkImplementation(const std::string& config, } // Lookup any existing link implementation for this configuration. - TargetConfigPair key(head, cmSystemTools::UpperCase(config)); + TargetConfigPair key(this, cmSystemTools::UpperCase(config)); cmTargetInternals::LinkImplMapType::iterator i = this->Internal->LinkImplMap.find(key); @@ -6532,8 +6534,8 @@ cmTarget::GetLinkImplementation(const std::string& config, { // Compute the link implementation for this configuration. LinkImplementation impl; - this->ComputeLinkImplementation(config, impl, head); - this->ComputeLinkImplementationLanguages(config, impl, head); + this->ComputeLinkImplementation(config, impl, this); + this->ComputeLinkImplementationLanguages(config, impl, this); // Store the information for this configuration. cmTargetInternals::LinkImplMapType::value_type entry(key, impl); @@ -6541,7 +6543,7 @@ cmTarget::GetLinkImplementation(const std::string& config, } else if (i->second.Languages.empty()) { - this->ComputeLinkImplementationLanguages(config, i->second, head); + this->ComputeLinkImplementationLanguages(config, i->second, this); } return &i->second; @@ -6549,8 +6551,15 @@ cmTarget::GetLinkImplementation(const std::string& config, //---------------------------------------------------------------------------- cmTarget::LinkImplementation const* -cmTarget::GetLinkImplementationLibraries(const std::string& config, - cmTarget const* head) const +cmTarget::GetLinkImplementationLibraries(const std::string& config) const +{ + return this->GetLinkImplementationLibrariesInternal(config, this); +} + +//---------------------------------------------------------------------------- +cmTarget::LinkImplementation const* +cmTarget::GetLinkImplementationLibrariesInternal(const std::string& config, + cmTarget const* head) const { // There is no link implementation for imported targets. if(this->IsImported()) @@ -6584,15 +6593,41 @@ void cmTarget::ComputeLinkImplementation(const std::string& config, { // Collect libraries directly linked in this configuration. std::vector<std::string> llibs; - this->GetDirectLinkLibraries(config, llibs, head); + if(const char *prop = this->GetProperty("LINK_LIBRARIES")) + { + cmGeneratorExpression ge; + const cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop); + + cmGeneratorExpressionDAGChecker dagChecker( + this->GetName(), + "LINK_LIBRARIES", 0, 0); + cmSystemTools::ExpandListArgument(cge->Evaluate(this->Makefile, + config, + false, + head, + &dagChecker), + llibs); + + std::set<std::string> const& seenProps = cge->GetSeenTargetProperties(); + for (std::set<std::string>::const_iterator it = seenProps.begin(); + it != seenProps.end(); ++it) + { + if (!this->GetProperty(*it)) + { + this->LinkImplicitNullProperties.insert(*it); + } + } + cge->GetMaxLanguageStandard(this, this->MaxLanguageStandards); + } + for(std::vector<std::string>::const_iterator li = llibs.begin(); li != llibs.end(); ++li) { // Skip entries that resolve to the target itself or are empty. - std::string item = this->CheckCMP0004(*li); - if(item == this->GetName() || item.empty()) + std::string name = this->CheckCMP0004(*li); + if(name == this->GetName() || name.empty()) { - if(item == this->GetName()) + if(name == this->GetName()) { bool noMessage = false; cmake::MessageType messageType = cmake::FATAL_ERROR; @@ -6631,7 +6666,8 @@ void cmTarget::ComputeLinkImplementation(const std::string& config, } // The entry is meant for this configuration. - impl.Libraries.push_back(item); + impl.Libraries.push_back( + cmLinkItem(name, this->FindTargetToLink(name))); } cmTarget::LinkLibraryType linkType = this->ComputeLinkType(config); @@ -6641,13 +6677,14 @@ void cmTarget::ComputeLinkImplementation(const std::string& config, { if(li->second != cmTarget::GENERAL && li->second != linkType) { - std::string item = this->CheckCMP0004(li->first); - if(item == this->GetName() || item.empty()) + std::string name = this->CheckCMP0004(li->first); + if(name == this->GetName() || name.empty()) { continue; } // Support OLD behavior for CMP0003. - impl.WrongConfigLibraries.push_back(item); + impl.WrongConfigLibraries.push_back( + cmLinkItem(name, this->FindTargetToLink(name))); } } } @@ -6671,6 +6708,37 @@ cmTarget::ComputeLinkImplementationLanguages(const std::string& config, } //---------------------------------------------------------------------------- +cmTarget const* cmTarget::FindTargetToLink(std::string const& name) const +{ + cmTarget const* tgt = this->Makefile->FindTargetToUse(name); + + // Skip targets that will not really be linked. This is probably a + // name conflict between an external library and an executable + // within the project. + if(tgt && tgt->GetType() == cmTarget::EXECUTABLE && + !tgt->IsExecutableWithExports()) + { + tgt = 0; + } + + if(tgt && tgt->GetType() == cmTarget::OBJECT_LIBRARY) + { + cmOStringStream e; + e << "Target \"" << this->GetName() << "\" links to " + "OBJECT library \"" << tgt->GetName() << "\" but this is not " + "allowed. " + "One may link only to STATIC or SHARED libraries, or to executables " + "with the ENABLE_EXPORTS property set."; + cmake* cm = this->Makefile->GetCMakeInstance(); + cm->IssueMessage(cmake::FATAL_ERROR, e.str(), this->GetBacktrace()); + tgt = 0; + } + + // Return the target found, if any. + return tgt; +} + +//---------------------------------------------------------------------------- std::string cmTarget::CheckCMP0004(std::string const& item) const { // Strip whitespace off the library names because we used to do this @@ -6967,19 +7035,17 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info, //---------------------------------------------------------------------------- cmComputeLinkInformation* -cmTarget::GetLinkInformation(const std::string& config, - cmTarget const* head) const +cmTarget::GetLinkInformation(const std::string& config) const { - cmTarget const* headTarget = head ? head : this; // Lookup any existing information for this configuration. - TargetConfigPair key(headTarget, cmSystemTools::UpperCase(config)); + std::string key(cmSystemTools::UpperCase(config)); cmTargetLinkInformationMap::iterator i = this->LinkInformation.find(key); if(i == this->LinkInformation.end()) { // Compute information for this configuration. cmComputeLinkInformation* info = - new cmComputeLinkInformation(this, config, headTarget); + new cmComputeLinkInformation(this, config); if(!info || !info->Compute()) { delete info; diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 2d51835..3f534f2 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -43,12 +43,22 @@ class cmTarget; class cmGeneratorTarget; class cmTargetTraceDependencies; +// Basic information about each link item. +class cmLinkItem: public std::string +{ + typedef std::string std_string; +public: + cmLinkItem(): std_string(), Target(0) {} + cmLinkItem(const std_string& n, + cmTarget const* t): std_string(n), Target(t) {} + cmLinkItem(cmLinkItem const& r): std_string(r), Target(r.Target) {} + cmTarget const* Target; +}; + struct cmTargetLinkInformationMap: - public std::map<std::pair<cmTarget const* , std::string>, - cmComputeLinkInformation*> + public std::map<std::string, cmComputeLinkInformation*> { - typedef std::map<std::pair<cmTarget const* , std::string>, - cmComputeLinkInformation*> derived; + typedef std::map<std::string, cmComputeLinkInformation*> derived; cmTargetLinkInformationMap() {} cmTargetLinkInformationMap(cmTargetLinkInformationMap const& r); ~cmTargetLinkInformationMap(); @@ -159,12 +169,6 @@ public: return this->LinkLibraries;} const LinkLibraryVectorType &GetOriginalLinkLibraries() const {return this->OriginalLinkLibraries;} - void GetDirectLinkLibraries(const std::string& config, - std::vector<std::string> &, - cmTarget const* head) const; - void GetInterfaceLinkLibraries(const std::string& config, - std::vector<std::string> &, - cmTarget const* head) const; /** Compute the link type to use for the given configuration. */ LinkLibraryType ComputeLinkType(const std::string& config) const; @@ -221,6 +225,7 @@ public: void AddUtility(const std::string& u, cmMakefile *makefile = 0); ///! Get the utilities used by this target std::set<std::string>const& GetUtilities() const { return this->Utilities; } + std::set<cmLinkItem>const& GetUtilityItems() const; cmListFileBacktrace const* GetUtilityBacktrace(const std::string& u) const; /** Finalize the target at the end of the Configure step. */ @@ -252,10 +257,10 @@ public: std::vector<std::string> Languages; // Libraries listed in the interface. - std::vector<std::string> Libraries; + std::vector<cmLinkItem> Libraries; // Shared library dependencies needed for linking on some platforms. - std::vector<std::string> SharedDeps; + std::vector<cmLinkItem> SharedDeps; // Number of repetitions of a strongly connected component of two // or more static libraries. @@ -263,7 +268,7 @@ public: // Libraries listed for other configurations. // Needed only for OLD behavior of CMP0003. - std::vector<std::string> WrongConfigLibraries; + std::vector<cmLinkItem> WrongConfigLibraries; bool ImplementationIsInterface; @@ -277,11 +282,10 @@ public: LinkInterface const* GetLinkInterfaceLibraries(const std::string& config, cmTarget const* headTarget) const; void GetTransitivePropertyTargets(const std::string& config, - cmTarget const* headTarget, - std::vector<cmTarget*> &libs) const; - void GetTransitiveTargetClosure(const std::string& config, - cmTarget const* headTarget, - std::vector<cmTarget*> &libs) const; + cmTarget const* headTarget, + std::vector<cmTarget const*> &libs) const; + std::vector<cmTarget const*> const& + GetLinkImplementationClosure(const std::string& config) const; /** The link implementation specifies the direct library dependencies needed by the object files of the target. */ @@ -291,18 +295,17 @@ public: std::vector<std::string> Languages; // Libraries linked directly in this configuration. - std::vector<std::string> Libraries; + std::vector<cmLinkItem> Libraries; // Libraries linked directly in other configurations. // Needed only for OLD behavior of CMP0003. - std::vector<std::string> WrongConfigLibraries; + std::vector<cmLinkItem> WrongConfigLibraries; }; - LinkImplementation const* GetLinkImplementation(const std::string& config, - cmTarget const* head) const; + LinkImplementation const* + GetLinkImplementation(const std::string& config) const; - LinkImplementation const* GetLinkImplementationLibraries( - const std::string& config, - cmTarget const* head) const; + LinkImplementation const* + GetLinkImplementationLibraries(const std::string& config) const; /** Link information from the transitive closure of the link implementation and the interfaces of its dependencies. */ @@ -314,8 +317,9 @@ public: // Languages whose runtime libraries must be linked. std::vector<std::string> Languages; }; - LinkClosure const* GetLinkClosure(const std::string& config, - cmTarget const* head) const; + LinkClosure const* GetLinkClosure(const std::string& config) const; + + cmTarget const* FindTargetToLink(std::string const& name) const; /** Strip off leading and trailing whitespace from an item named in the link dependencies of this target. */ @@ -361,8 +365,7 @@ public: GetTargetVersion(bool soversion, int& major, int& minor, int& patch) const; ///! Return the preferred linker language for this target - std::string GetLinkerLanguage(const std::string& config = "", - cmTarget const* head = 0) const; + std::string GetLinkerLanguage(const std::string& config = "") const; /** Get the full name of the target according to the settings in its makefile. */ @@ -446,8 +449,8 @@ public: * install tree. For example: "\@rpath/" or "\@loader_path/". */ std::string GetInstallNameDirForInstallTree() const; - cmComputeLinkInformation* GetLinkInformation(const std::string& config, - cmTarget const* head = 0) const; + cmComputeLinkInformation* + GetLinkInformation(const std::string& config) const; // Get the properties cmPropertyMap &GetProperties() const { return this->Properties; } @@ -740,10 +743,9 @@ private: // Cache import information from properties for each configuration. struct ImportInfo; - ImportInfo const* GetImportInfo(const std::string& config, - cmTarget const* workingTarget) const; - void ComputeImportInfo(std::string const& desired_config, ImportInfo& info, - cmTarget const* head) const; + ImportInfo const* GetImportInfo(const std::string& config) const; + void ComputeImportInfo(std::string const& desired_config, + ImportInfo& info) const; // Cache target compile paths for each configuration. struct CompileInfo; @@ -753,19 +755,31 @@ private: void CheckPropertyCompatibility(cmComputeLinkInformation *info, const std::string& config) const; + LinkInterface const* + GetImportLinkInterface(const std::string& config, + cmTarget const* head) const; + const char* ComputeLinkInterfaceLibraries(const std::string& config, LinkInterface& iface, cmTarget const* head, bool &exists) const; + LinkImplementation const* + GetLinkImplementationLibrariesInternal(const std::string& config, + cmTarget const* head) const; void ComputeLinkImplementation(const std::string& config, LinkImplementation& impl, cmTarget const* head) const; void ComputeLinkImplementationLanguages(const std::string& config, LinkImplementation& impl, cmTarget const* head) const; - void ComputeLinkClosure(const std::string& config, LinkClosure& lc, - cmTarget const* head) const; + void ComputeLinkClosure(const std::string& config, LinkClosure& lc) const; + + void ExpandLinkItems(std::string const& prop, std::string const& value, + std::string const& config, cmTarget const* headTarget, + std::vector<cmLinkItem>& items) const; + void LookupLinkItems(std::vector<std::string> const& names, + std::vector<cmLinkItem>& items) const; std::string ProcessSourceItemCMP0049(const std::string& s); diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 9aee975..a0c67e0 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -61,6 +61,8 @@ void CMakeCommandUsage(const char* program) << " echo [string]... - displays arguments as text\n" << " echo_append [string]... - displays arguments as text but no new " "line\n" + << " env [--unset=NAME]... [NAME=VALUE]... COMMAND [ARG]...\n" + << " - run command in a modified environment\n" << " environment - display the current environment\n" << " make_directory dir - create a directory\n" << " md5sum file1 [...] - compute md5sum of files\n" @@ -190,6 +192,55 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) return 0; } + else if (args[1] == "env" ) + { + std::vector<std::string>::const_iterator ai = args.begin() + 2; + std::vector<std::string>::const_iterator ae = args.end(); + for(; ai != ae; ++ai) + { + std::string const& a = *ai; + if(cmHasLiteralPrefix(a, "--unset=")) + { + // Unset environment variable. + cmSystemTools::UnPutEnv(a.c_str() + 8); + } + else if(!a.empty() && a[0] == '-') + { + // Environment variable and command names cannot start in '-', + // so this must be an unknown option. + std::cerr << "cmake -E env: unknown option '" << a << "'" + << std::endl; + return 1; + } + else if(a.find("=") != a.npos) + { + // Set environment variable. + cmSystemTools::PutEnv(a.c_str()); + } + else + { + // This is the beginning of the command. + break; + } + } + + if(ai == ae) + { + std::cerr << "cmake -E env: no command given" << std::endl; + return 1; + } + + // Execute command from remaining arguments. + std::vector<std::string> cmd(ai, ae); + int retval; + if(cmSystemTools::RunSingleCommand( + cmd, 0, &retval, NULL, cmSystemTools::OUTPUT_PASSTHROUGH)) + { + return retval; + } + return 1; + } + #if defined(CMAKE_BUILD_WITH_CMAKE) // Command to create a symbolic link. Fails on platforms not // supporting them. diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 273a541..cf7bd75 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2549,7 +2549,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release if (CMAKE_TESTS_CDASH_SERVER) - set(regex "^([^:]+)://([^/]+)(/.*)$") + set(regex "^([^:]+)://([^/]+)(.*)$") if ("${CMAKE_TESTS_CDASH_SERVER}" MATCHES "${regex}") set(protocol "${CMAKE_MATCH_1}") @@ -2557,8 +2557,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set(path "${CMAKE_MATCH_3}") else () set(protocol "http") - set(server "www.cdash.org") - set(path "/CDash") + set(server "open.cdash.org") + set(path "") message("warning: CMAKE_TESTS_CDASH_SERVER does not match expected regex...") message(" ...using default url='${protocol}://${server}${path}' for CTestTest[23]") endif () diff --git a/Tests/CTestTestBadExe/CTestConfig.cmake b/Tests/CTestTestBadExe/CTestConfig.cmake index 1d46ea3..c7286e2 100644 --- a/Tests/CTestTestBadExe/CTestConfig.cmake +++ b/Tests/CTestTestBadExe/CTestConfig.cmake @@ -2,6 +2,6 @@ set (CTEST_PROJECT_NAME "CTestTestBadExe") 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 "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestBadGenerator/CTestConfig.cmake b/Tests/CTestTestBadGenerator/CTestConfig.cmake index ef98189..1e61bf4 100644 --- a/Tests/CTestTestBadGenerator/CTestConfig.cmake +++ b/Tests/CTestTestBadGenerator/CTestConfig.cmake @@ -2,6 +2,6 @@ set (CTEST_PROJECT_NAME "CTestTestBadGenerator") 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 "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestConfigFileInBuildDir/CTestConfig.cmake b/Tests/CTestTestConfigFileInBuildDir/CTestConfig.cmake index d2c28f9..4458348 100644 --- a/Tests/CTestTestConfigFileInBuildDir/CTestConfig.cmake +++ b/Tests/CTestTestConfigFileInBuildDir/CTestConfig.cmake @@ -2,6 +2,6 @@ set(CTEST_PROJECT_NAME "CTestTestConfigFileInBuildDir") set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC") 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 "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestCostSerial/CTestConfig.cmake b/Tests/CTestTestCostSerial/CTestConfig.cmake index 05c20eb..3ab99ac 100644 --- a/Tests/CTestTestCostSerial/CTestConfig.cmake +++ b/Tests/CTestTestCostSerial/CTestConfig.cmake @@ -2,6 +2,6 @@ set(CTEST_PROJECT_NAME "CTestTestCostSerial") 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 "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestCrash/CTestConfig.cmake b/Tests/CTestTestCrash/CTestConfig.cmake index e1c5b1b..5c2ca0e 100644 --- a/Tests/CTestTestCrash/CTestConfig.cmake +++ b/Tests/CTestTestCrash/CTestConfig.cmake @@ -2,6 +2,6 @@ set (CTEST_PROJECT_NAME "CTestTestCrash") 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 "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestCycle/CTestConfig.cmake b/Tests/CTestTestCycle/CTestConfig.cmake index 43e9986..8aeb09b 100644 --- a/Tests/CTestTestCycle/CTestConfig.cmake +++ b/Tests/CTestTestCycle/CTestConfig.cmake @@ -2,6 +2,6 @@ set (CTEST_PROJECT_NAME "CTestTestCycle") 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 "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestDepends/CTestConfig.cmake b/Tests/CTestTestDepends/CTestConfig.cmake index e3af7dd..7af9200 100644 --- a/Tests/CTestTestDepends/CTestConfig.cmake +++ b/Tests/CTestTestDepends/CTestConfig.cmake @@ -2,6 +2,6 @@ set (CTEST_PROJECT_NAME "CTestTestDepends") 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 "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestFailure/CTestConfig.cmake b/Tests/CTestTestFailure/CTestConfig.cmake index fd8d97a..07e1be0 100644 --- a/Tests/CTestTestFailure/CTestConfig.cmake +++ b/Tests/CTestTestFailure/CTestConfig.cmake @@ -2,6 +2,6 @@ set (CTEST_PROJECT_NAME "CTestTestFailure") 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 "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestLaunchers/launcher_test_project/CTestConfig.cmake b/Tests/CTestTestLaunchers/launcher_test_project/CTestConfig.cmake index bf404ab..669b0fb 100644 --- a/Tests/CTestTestLaunchers/launcher_test_project/CTestConfig.cmake +++ b/Tests/CTestTestLaunchers/launcher_test_project/CTestConfig.cmake @@ -3,6 +3,6 @@ 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 "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestMemcheck/CTestConfig.cmake.in b/Tests/CTestTestMemcheck/CTestConfig.cmake.in index 6cf3782..19c76c2 100644 --- a/Tests/CTestTestMemcheck/CTestConfig.cmake.in +++ b/Tests/CTestTestMemcheck/CTestConfig.cmake.in @@ -2,8 +2,8 @@ set (CTEST_PROJECT_NAME "CTestTestMemcheck@SUBTEST_NAME@") 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 "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) @CTEST_EXTRA_CONFIG@ diff --git a/Tests/CTestTestParallel/CTestConfig.cmake b/Tests/CTestTestParallel/CTestConfig.cmake index c3c5038..fc5b666 100644 --- a/Tests/CTestTestParallel/CTestConfig.cmake +++ b/Tests/CTestTestParallel/CTestConfig.cmake @@ -2,6 +2,6 @@ set(CTEST_PROJECT_NAME "CTestTestParallel") 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 "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestResourceLock/CTestConfig.cmake b/Tests/CTestTestResourceLock/CTestConfig.cmake index 5fb560b..c118777 100644 --- a/Tests/CTestTestResourceLock/CTestConfig.cmake +++ b/Tests/CTestTestResourceLock/CTestConfig.cmake @@ -2,6 +2,6 @@ set(CTEST_PROJECT_NAME "CTestTestResourceLock") 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 "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestScheduler/CTestConfig.cmake b/Tests/CTestTestScheduler/CTestConfig.cmake index 7da8f6f..797387b 100644 --- a/Tests/CTestTestScheduler/CTestConfig.cmake +++ b/Tests/CTestTestScheduler/CTestConfig.cmake @@ -2,6 +2,6 @@ set(CTEST_PROJECT_NAME "CTestTestScheduler") 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 "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestSkipReturnCode/CTestConfig.cmake b/Tests/CTestTestSkipReturnCode/CTestConfig.cmake index ad8e00e..da0c76b 100644 --- a/Tests/CTestTestSkipReturnCode/CTestConfig.cmake +++ b/Tests/CTestTestSkipReturnCode/CTestConfig.cmake @@ -2,6 +2,6 @@ set (CTEST_PROJECT_NAME "CTestTestSkipReturnCode") set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set (CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestStopTime/CTestConfig.cmake b/Tests/CTestTestStopTime/CTestConfig.cmake index 129db4d..412283e 100644 --- a/Tests/CTestTestStopTime/CTestConfig.cmake +++ b/Tests/CTestTestStopTime/CTestConfig.cmake @@ -2,6 +2,6 @@ set (CTEST_PROJECT_NAME "CTestTestStopTime") 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 "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestSubdir/CTestConfig.cmake b/Tests/CTestTestSubdir/CTestConfig.cmake index 4b848aa..47ebb92 100644 --- a/Tests/CTestTestSubdir/CTestConfig.cmake +++ b/Tests/CTestTestSubdir/CTestConfig.cmake @@ -2,6 +2,6 @@ set(CTEST_PROJECT_NAME "CTestTestSubdir") 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 "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestTimeout/CTestConfig.cmake b/Tests/CTestTestTimeout/CTestConfig.cmake index 76d62ad..13114f1 100644 --- a/Tests/CTestTestTimeout/CTestConfig.cmake +++ b/Tests/CTestTestTimeout/CTestConfig.cmake @@ -2,6 +2,6 @@ set(CTEST_PROJECT_NAME "CTestTestTimeout") 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 "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestUpload/CTestConfig.cmake b/Tests/CTestTestUpload/CTestConfig.cmake index 89c5b94..a547088 100644 --- a/Tests/CTestTestUpload/CTestConfig.cmake +++ b/Tests/CTestTestUpload/CTestConfig.cmake @@ -2,6 +2,6 @@ set (CTEST_PROJECT_NAME "CTestTestUpload") 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 "open.cdash.org") +set (CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set (CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestZeroTimeout/CTestConfig.cmake b/Tests/CTestTestZeroTimeout/CTestConfig.cmake index f8e0609..6094864 100644 --- a/Tests/CTestTestZeroTimeout/CTestConfig.cmake +++ b/Tests/CTestTestZeroTimeout/CTestConfig.cmake @@ -2,6 +2,6 @@ set(CTEST_PROJECT_NAME "CTestTestZeroTimeout") 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 "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/InterfaceLibrary/CMakeLists.txt b/Tests/InterfaceLibrary/CMakeLists.txt index 81b34e6..d4f49c2 100644 --- a/Tests/InterfaceLibrary/CMakeLists.txt +++ b/Tests/InterfaceLibrary/CMakeLists.txt @@ -8,8 +8,18 @@ target_compile_definitions(iface_nodepends INTERFACE IFACE_DEFINE) add_subdirectory(headerdir) +# Add an interface target in a subdirectory that uses an imported interface. +add_subdirectory(ifacedir) + +# Poison an imported interface with the same name as that in the subdir +# to ensure that the transitive lookup occurs in the subdir. +add_library(imp::iface INTERFACE IMPORTED) +set_property(TARGET imp::iface APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SOMEPROP) +set_property(TARGET imp::iface PROPERTY INTERFACE_SOMEPROP OFF) +set_property(TARGET imp::iface PROPERTY INTERFACE_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/does_not_exist.cpp) + add_executable(InterfaceLibrary definetestexe.cpp) -target_link_libraries(InterfaceLibrary iface_nodepends headeriface) +target_link_libraries(InterfaceLibrary iface_nodepends headeriface subiface) add_subdirectory(libsdir) diff --git a/Tests/InterfaceLibrary/definetestexe.cpp b/Tests/InterfaceLibrary/definetestexe.cpp index e7a10c1..30f2925 100644 --- a/Tests/InterfaceLibrary/definetestexe.cpp +++ b/Tests/InterfaceLibrary/definetestexe.cpp @@ -15,7 +15,9 @@ #error Expected IFACE_HEADER_BUILDDIR #endif +extern int sub(); + int main(int,char**) { - return 0; + return sub(); } diff --git a/Tests/InterfaceLibrary/ifacedir/CMakeLists.txt b/Tests/InterfaceLibrary/ifacedir/CMakeLists.txt new file mode 100644 index 0000000..228715e --- /dev/null +++ b/Tests/InterfaceLibrary/ifacedir/CMakeLists.txt @@ -0,0 +1,8 @@ +add_library(imp::iface INTERFACE IMPORTED) +set_property(TARGET imp::iface APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SOMEPROP) +set_property(TARGET imp::iface PROPERTY INTERFACE_SOMEPROP ON) +set_property(TARGET imp::iface PROPERTY INTERFACE_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/sub.cpp) + +add_library(subiface INTERFACE) +target_link_libraries(subiface INTERFACE imp::iface) +set_property(TARGET subiface PROPERTY INTERFACE_SOMEPROP ON) diff --git a/Tests/InterfaceLibrary/ifacedir/sub.cpp b/Tests/InterfaceLibrary/ifacedir/sub.cpp new file mode 100644 index 0000000..165a66a --- /dev/null +++ b/Tests/InterfaceLibrary/ifacedir/sub.cpp @@ -0,0 +1 @@ +int sub() { return 0; } diff --git a/Tests/RunCMake/CommandLine/E_env-bad-arg1-result.txt b/Tests/RunCMake/CommandLine/E_env-bad-arg1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-bad-arg1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_env-bad-arg1-stderr.txt b/Tests/RunCMake/CommandLine/E_env-bad-arg1-stderr.txt new file mode 100644 index 0000000..2143ba4 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-bad-arg1-stderr.txt @@ -0,0 +1 @@ +^cmake -E env: unknown option '-bad-arg1'$ diff --git a/Tests/RunCMake/CommandLine/E_env-no-command0-result.txt b/Tests/RunCMake/CommandLine/E_env-no-command0-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-no-command0-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_env-no-command0-stderr.txt b/Tests/RunCMake/CommandLine/E_env-no-command0-stderr.txt new file mode 100644 index 0000000..d2efa53 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-no-command0-stderr.txt @@ -0,0 +1 @@ +^cmake -E env: no command given$ diff --git a/Tests/RunCMake/CommandLine/E_env-no-command1-result.txt b/Tests/RunCMake/CommandLine/E_env-no-command1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-no-command1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_env-no-command1-stderr.txt b/Tests/RunCMake/CommandLine/E_env-no-command1-stderr.txt new file mode 100644 index 0000000..d2efa53 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-no-command1-stderr.txt @@ -0,0 +1 @@ +^cmake -E env: no command given$ diff --git a/Tests/RunCMake/CommandLine/E_env-set-stdout.txt b/Tests/RunCMake/CommandLine/E_env-set-stdout.txt new file mode 100644 index 0000000..feff117 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-set-stdout.txt @@ -0,0 +1 @@ +^-- TEST_ENV is correctly set in environment: 1$ diff --git a/Tests/RunCMake/CommandLine/E_env-set.cmake b/Tests/RunCMake/CommandLine/E_env-set.cmake new file mode 100644 index 0000000..c2639b6 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-set.cmake @@ -0,0 +1,5 @@ +if(DEFINED ENV{TEST_ENV}) + message(STATUS "TEST_ENV is correctly set in environment: $ENV{TEST_ENV}") +else() + message(FATAL_ERROR "TEST_ENV is incorrectly not set in environment") +endif() diff --git a/Tests/RunCMake/CommandLine/E_env-unset-stdout.txt b/Tests/RunCMake/CommandLine/E_env-unset-stdout.txt new file mode 100644 index 0000000..a1d5c01 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-unset-stdout.txt @@ -0,0 +1 @@ +^-- TEST_ENV is correctly not set in environment$ diff --git a/Tests/RunCMake/CommandLine/E_env-unset.cmake b/Tests/RunCMake/CommandLine/E_env-unset.cmake new file mode 100644 index 0000000..04976fb --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-unset.cmake @@ -0,0 +1,5 @@ +if(DEFINED ENV{TEST_ENV}) + message(FATAL_ERROR "TEST_ENV is incorrectly set in environment") +else() + message(STATUS "TEST_ENV is correctly not set in environment") +endif() diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index f3d9637..5622a5b 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -31,6 +31,12 @@ if(UNIX) ) endif() +run_cmake_command(E_env-no-command0 ${CMAKE_COMMAND} -E env) +run_cmake_command(E_env-no-command1 ${CMAKE_COMMAND} -E env TEST_ENV=1) +run_cmake_command(E_env-bad-arg1 ${CMAKE_COMMAND} -E env -bad-arg1) +run_cmake_command(E_env-set ${CMAKE_COMMAND} -E env TEST_ENV=1 ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-set.cmake) +run_cmake_command(E_env-unset ${CMAKE_COMMAND} -E env TEST_ENV=1 ${CMAKE_COMMAND} -E env --unset=TEST_ENV ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-unset.cmake) + run_cmake_command(E_sleep-no-args ${CMAKE_COMMAND} -E sleep) run_cmake_command(E_sleep-bad-arg1 ${CMAKE_COMMAND} -E sleep x) run_cmake_command(E_sleep-bad-arg2 ${CMAKE_COMMAND} -E sleep 1 -1) |