diff options
-rw-r--r-- | Help/command/link_libraries.rst | 19 | ||||
-rw-r--r-- | Help/manual/cmake-commands.7.rst | 2 | ||||
-rw-r--r-- | Modules/FeatureSummary.cmake | 4 | ||||
-rw-r--r-- | Modules/FindOpenSSL.cmake | 2 | ||||
-rw-r--r-- | Source/CPack/cmCPackGenerator.cxx | 12 | ||||
-rw-r--r-- | Source/CTest/cmCTestBuildHandler.cxx | 4 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 8 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 14 | ||||
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 8 | ||||
-rw-r--r-- | Source/kwsys/Directory.cxx | 5 | ||||
-rw-r--r-- | Tests/CustomCommand/CMakeLists.txt | 13 | ||||
-rw-r--r-- | Tests/CustomCommand/foo.in | 5 | ||||
-rw-r--r-- | Tests/CustomCommand/subdir.h.in | 1 |
13 files changed, 74 insertions, 23 deletions
diff --git a/Help/command/link_libraries.rst b/Help/command/link_libraries.rst index d690c9b..fd5dc37 100644 --- a/Help/command/link_libraries.rst +++ b/Help/command/link_libraries.rst @@ -1,16 +1,19 @@ link_libraries -------------- -Deprecated. Use the target_link_libraries() command instead. - Link libraries to all targets added later. :: - link_libraries(library1 <debug | optimized> library2 ...) + link_libraries([item1 [item2 [...]]] + [[debug|optimized|general] <item>] ...) + +Specify libraries or flags to use when linking any targets created later in +the current directory or below by commands such as :command:`add_executable` +or :command:`add_library`. See the :command:`target_link_libraries` command +for meaning of arguments. -Specify a list of libraries to be linked into any following targets -(typically added with the add_executable or add_library calls). This -command is passed down to all subdirectories. The debug and optimized -strings may be used to indicate that the next library listed is to be -used only for that specific type of build. +.. note:: + The :command:`target_link_libraries` command should be preferred whenever + possible. Library dependencies are chained automatically, so directory-wide + specification of link libraries is rarely needed. diff --git a/Help/manual/cmake-commands.7.rst b/Help/manual/cmake-commands.7.rst index 9c1d3b9..14871f2 100644 --- a/Help/manual/cmake-commands.7.rst +++ b/Help/manual/cmake-commands.7.rst @@ -67,6 +67,7 @@ These commands may be used freely in CMake projects. /command/include /command/install /command/link_directories + /command/link_libraries /command/list /command/load_cache /command/load_command @@ -117,7 +118,6 @@ versions of CMake. Do not use them in new code. /command/install_files /command/install_programs /command/install_targets - /command/link_libraries /command/make_directory /command/output_required_files /command/remove diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake index 9016db8..3eea9db 100644 --- a/Modules/FeatureSummary.cmake +++ b/Modules/FeatureSummary.cmake @@ -40,7 +40,7 @@ # [FATAL_ON_MISSING_REQUIRED_PACKAGES] # [DESCRIPTION "Found packages:"] # WHAT (ALL | PACKAGES_FOUND | PACKAGES_NOT_FOUND -# | ENABLED_FEATURES | DISABLED_FEATURES] +# | ENABLED_FEATURES | DISABLED_FEATURES) # ) # # @@ -265,7 +265,7 @@ # Does the same as SET_PACKAGE_INFO(<name> <description> <url> ) #============================================================================= -# Copyright 2007-2009 Kitware, Inc. +# Copyright 2007-2015 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index 340b417..6b4f985 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -279,7 +279,7 @@ if (OPENSSL_INCLUDE_DIR) set(OPENSSL_VERSION "${_OPENSSL_VERSION}") elseif(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h") file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str - REGEX "^#define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*") + REGEX "^# *define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*") # The version number is encoded as 0xMNNFFPPS: major minor fix patch status # The status gives if this is a developer or prerelease and is ignored here. diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 84e6482..8139d29 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -437,6 +437,18 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( cmCPackLogger(cmCPackLog::LOG_DEBUG, "Will create a symlink: " << symlinkedIt->second << "--> " << symlinkedIt->first << std::endl); + // make sure directory exists for symlink + std::string destDir = + cmSystemTools::GetFilenamePath(symlinkedIt->second); + if(!destDir.empty() && !cmSystemTools::MakeDirectory(destDir)) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot create dir: " + << destDir + << "\nTrying to create symlink: " + << symlinkedIt->second << "--> " + << symlinkedIt->first + << std::endl); + } if (!cmSystemTools::CreateSymlink((symlinkedIt->first).c_str(), (symlinkedIt->second).c_str())) { diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 2ec1365..13404a8 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -70,13 +70,13 @@ static const char* cmCTestErrorMatches[] = { "^CMake Error.*:", ":[ \\t]cannot find", ":[ \\t]can't find", - ": \\*\\*\\* No rule to make target \\`.*\\'. Stop", + ": \\*\\*\\* No rule to make target \\[`'].*\\'. Stop", ": \\*\\*\\* No targets specified and no makefile found", ": Invalid loader fixup for symbol", ": Invalid fixups exist", ": Can't find library for", ": internal link edit command failed", - ": Unrecognized option \\`.*\\'", + ": Unrecognized option \\[`'].*\\'", "\", line [0-9]+\\.[0-9]+: [0-9]+-[0-9]+ \\([^WI]\\)", "ld: 0706-006 Cannot find or open library file: -l ", "ild: \\(argument error\\) can't find library argument ::", diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 14b5a92..0c60237 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -676,6 +676,14 @@ void cmTargetTraceDependencies::Trace() { std::vector<std::string> objDeps; cmSystemTools::ExpandListArgument(additionalDeps, objDeps); + for(std::vector<std::string>::iterator odi = objDeps.begin(); + odi != objDeps.end(); ++odi) + { + if (cmSystemTools::FileIsFullPath(*odi)) + { + *odi = cmSystemTools::CollapseFullPath(*odi); + } + } this->FollowNames(objDeps); } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 50e279b..e726ab9 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -390,27 +390,23 @@ void cmLocalGenerator::GenerateInstallRules() this->Makefile->GetConfigurations(configurationTypes, false); // Choose a default install configuration. - const char* default_config = config.c_str(); + std::string default_config = config; const char* default_order[] = {"RELEASE", "MINSIZEREL", "RELWITHDEBINFO", "DEBUG", 0}; - for(const char** c = default_order; *c && !default_config; ++c) + for(const char** c = default_order; *c && default_config.empty(); ++c) { for(std::vector<std::string>::iterator i = configurationTypes.begin(); i != configurationTypes.end(); ++i) { if(cmSystemTools::UpperCase(*i) == *c) { - default_config = i->c_str(); + default_config = *i; } } } - if(!default_config && !configurationTypes.empty()) + if(default_config.empty() && !configurationTypes.empty()) { - default_config = configurationTypes[0].c_str(); - } - if(!default_config) - { - default_config = "Release"; + default_config = configurationTypes[0]; } // Create the install script file. diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index b8cc5fb..33000d6 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -600,6 +600,14 @@ cmNinjaTargetGenerator if(const char* objectDeps = source->GetProperty("OBJECT_DEPENDS")) { std::vector<std::string> depList; cmSystemTools::ExpandListArgument(objectDeps, depList); + for(std::vector<std::string>::iterator odi = depList.begin(); + odi != depList.end(); ++odi) + { + if (cmSystemTools::FileIsFullPath(*odi)) + { + *odi = cmSystemTools::CollapseFullPath(*odi); + } + } std::transform(depList.begin(), depList.end(), std::back_inserter(implicitDeps), MapToNinjaPath()); } diff --git a/Source/kwsys/Directory.cxx b/Source/kwsys/Directory.cxx index 741bcba..7041f7b 100644 --- a/Source/kwsys/Directory.cxx +++ b/Source/kwsys/Directory.cxx @@ -239,6 +239,11 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const kwsys_stl::string& na { DIR* dir = opendir(name.c_str()); + if (!dir) + { + return 0; + } + unsigned long count = 0; for (dirent* d = readdir(dir); d; d = readdir(dir) ) { diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt index b97cd16..7ef3540 100644 --- a/Tests/CustomCommand/CMakeLists.txt +++ b/Tests/CustomCommand/CMakeLists.txt @@ -153,6 +153,19 @@ add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/foo.c ${PROJECT_BINARY_DIR}/foo.c ) +# Test using OBJECT_DEPENDS to bring in a custom command. +# Use a path that can be simplified to make sure paths +# are consistently normalized. +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/subdir/../subdir/subdir.h + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_SOURCE_DIR}/subdir.h.in + ${CMAKE_CURRENT_BINARY_DIR}/subdir/subdir.h + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/subdir.h.in + ) +set_property(SOURCE ${PROJECT_BINARY_DIR}/foo.c PROPERTY + OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/subdir/../subdir/subdir.h) + # Add custom command to generate not_included.h, which is a header # file that is not included by any source in this project. This will # test whether all custom command outputs explicitly listed as sources diff --git a/Tests/CustomCommand/foo.in b/Tests/CustomCommand/foo.in index 0c5021c..5ca6315 100644 --- a/Tests/CustomCommand/foo.in +++ b/Tests/CustomCommand/foo.in @@ -7,6 +7,11 @@ int generated(); int wrapped(); +#include "subdir/subdir.h" +#ifndef SUBDIR_DEF +# error SUBDIR_DEF not defined +#endif + int main () { if (generated()*wrapped()*doc() == 3*5*7) diff --git a/Tests/CustomCommand/subdir.h.in b/Tests/CustomCommand/subdir.h.in new file mode 100644 index 0000000..1e50750 --- /dev/null +++ b/Tests/CustomCommand/subdir.h.in @@ -0,0 +1 @@ +#define SUBDIR_DEF |