This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake".
The branch, next has been updated via 16114ac346e661d7b3bb50dfd09a1a8f361751a4 (commit) via 69528fe65f0c4402c6560917d6cb118d2c103445 (commit) via f3102ca884496a4a0644dc43afaf80a253191ed8 (commit) via c3fb650c85a01f1a31f3f56f5ae630d4e6c6e98d (commit) from 2d590038de63afa16ebb9197ca070aba1130c39e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=16114ac346e661d7b3bb50dfd09a1a8f361751a4 commit 16114ac346e661d7b3bb50dfd09a1a8f361751a4 Merge: 2d59003 69528fe Author: Brad King <brad.k...@kitware.com> AuthorDate: Thu Mar 2 08:36:49 2017 -0500 Commit: CMake Topic Stage <kwro...@kitware.com> CommitDate: Thu Mar 2 08:36:49 2017 -0500 Merge topic 'implicit-dir-symlinks' into next 69528fe6 Tests: Add case for RPATH exclusion of symlinks to implicit directories f3102ca8 Merge branch 'backport-implicit-dir-symlinks' into implicit-dir-symlinks c3fb650c cmOrderDirectories: Consider symlinks when checking implicit directories https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=69528fe65f0c4402c6560917d6cb118d2c103445 commit 69528fe65f0c4402c6560917d6cb118d2c103445 Author: Brad King <brad.k...@kitware.com> AuthorDate: Wed Mar 1 12:38:10 2017 -0500 Commit: Brad King <brad.k...@kitware.com> CommitDate: Thu Mar 2 08:36:32 2017 -0500 Tests: Add case for RPATH exclusion of symlinks to implicit directories Issue: #16682 diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 63016f1..a16efb3 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -153,6 +153,9 @@ add_RunCMake_test(TargetPropertyGeneratorExpressions) add_RunCMake_test(Languages) add_RunCMake_test(LinkStatic) add_RunCMake_test(ObjectLibrary) +if(UNIX AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG AND CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF") + add_RunCMake_test(RuntimePath) +endif() add_RunCMake_test(Swift) add_RunCMake_test(TargetObjects) add_RunCMake_test(TargetSources) diff --git a/Tests/RunCMake/RuntimePath/A.c b/Tests/RunCMake/RuntimePath/A.c new file mode 100644 index 0000000..e9d4195 --- /dev/null +++ b/Tests/RunCMake/RuntimePath/A.c @@ -0,0 +1,4 @@ +int libA(void) +{ + return 0; +} diff --git a/Tests/RunCMake/RuntimePath/CMakeLists.txt b/Tests/RunCMake/RuntimePath/CMakeLists.txt new file mode 100644 index 0000000..a640c56 --- /dev/null +++ b/Tests/RunCMake/RuntimePath/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.7) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/RuntimePath/RunCMakeTest.cmake b/Tests/RunCMake/RuntimePath/RunCMakeTest.cmake new file mode 100644 index 0000000..a9a7f05 --- /dev/null +++ b/Tests/RunCMake/RuntimePath/RunCMakeTest.cmake @@ -0,0 +1,18 @@ +include(RunCMake) + + +function(run_SymlinkImplicit) + # Use a single build tree for a few tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/SymlinkImplicit-build) + set(RunCMake_TEST_NO_CLEAN 1) + if(RunCMake_GENERATOR MATCHES "Make|Ninja") + set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) + endif() + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(SymlinkImplicit) + run_cmake_command(SymlinkImplicit-build ${CMAKE_COMMAND} --build . --config Debug) + run_cmake_command(SymlinkImplicitCheck + ${CMAKE_COMMAND} -Ddir=${RunCMake_TEST_BINARY_DIR} -P ${RunCMake_SOURCE_DIR}/SymlinkImplicitCheck.cmake) +endfunction() +run_SymlinkImplicit() diff --git a/Tests/RunCMake/RuntimePath/SymlinkImplicit.cmake b/Tests/RunCMake/RuntimePath/SymlinkImplicit.cmake new file mode 100644 index 0000000..6578f8f --- /dev/null +++ b/Tests/RunCMake/RuntimePath/SymlinkImplicit.cmake @@ -0,0 +1,17 @@ +enable_language(C) + +set(lib_dir ${CMAKE_CURRENT_BINARY_DIR}/lib) +set(lib_link ${CMAKE_CURRENT_BINARY_DIR}/libLink) +set(lib_always ${CMAKE_CURRENT_BINARY_DIR}/libAlways) +file(MAKE_DIRECTORY ${lib_dir}) +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink lib ${lib_link}) +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink lib ${lib_always}) + +add_library(A SHARED A.c) +list(APPEND CMAKE_C_IMPLICIT_LINK_DIRECTORIES ${lib_dir}) +set_property(TARGET A PROPERTY LIBRARY_OUTPUT_DIRECTORY ${lib_link}) + +add_executable(exe main.c) +target_link_libraries(exe A) +set_property(TARGET exe PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) +set_property(TARGET exe PROPERTY BUILD_RPATH ${lib_always}) diff --git a/Tests/RunCMake/RuntimePath/SymlinkImplicitCheck-result.txt b/Tests/RunCMake/RuntimePath/SymlinkImplicitCheck-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/RuntimePath/SymlinkImplicitCheck-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/RuntimePath/SymlinkImplicitCheck-stderr.txt b/Tests/RunCMake/RuntimePath/SymlinkImplicitCheck-stderr.txt new file mode 100644 index 0000000..b0ede70 --- /dev/null +++ b/Tests/RunCMake/RuntimePath/SymlinkImplicitCheck-stderr.txt @@ -0,0 +1,22 @@ +^CMake Error at .*/Tests/RunCMake/RuntimePath/SymlinkImplicitCheck.cmake:[0-9]+ \(file\): + file RPATH_CHANGE could not write new RPATH: + + old-should-not-exist + + to the file: + + [^ +]*/Tests/RunCMake/RuntimePath/SymlinkImplicit-build/exe + + The current (RPATH|RUNPATH) is: + + [^ +]*/Tests/RunCMake/RuntimePath/SymlinkImplicit-build/libAlways(:[^ +]*)? + + which does not contain: + + [^ +]*/Tests/RunCMake/RuntimePath/SymlinkImplicit-build/libLink + + as was expected\.$ diff --git a/Tests/RunCMake/RuntimePath/SymlinkImplicitCheck.cmake b/Tests/RunCMake/RuntimePath/SymlinkImplicitCheck.cmake new file mode 100644 index 0000000..d34742e --- /dev/null +++ b/Tests/RunCMake/RuntimePath/SymlinkImplicitCheck.cmake @@ -0,0 +1,2 @@ +file(COPY ${dir}/bin/exe DESTINATION ${dir}) +file(RPATH_CHANGE FILE "${dir}/exe" OLD_RPATH "${dir}/libLink" NEW_RPATH "old-should-not-exist") diff --git a/Tests/RunCMake/RuntimePath/main.c b/Tests/RunCMake/RuntimePath/main.c new file mode 100644 index 0000000..8488f4e --- /dev/null +++ b/Tests/RunCMake/RuntimePath/main.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f3102ca884496a4a0644dc43afaf80a253191ed8 commit f3102ca884496a4a0644dc43afaf80a253191ed8 Merge: 6cbad49 c3fb650 Author: Brad King <brad.k...@kitware.com> AuthorDate: Wed Mar 1 12:40:04 2017 -0500 Commit: Brad King <brad.k...@kitware.com> CommitDate: Thu Mar 2 08:36:13 2017 -0500 Merge branch 'backport-implicit-dir-symlinks' into implicit-dir-symlinks https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c3fb650c85a01f1a31f3f56f5ae630d4e6c6e98d commit c3fb650c85a01f1a31f3f56f5ae630d4e6c6e98d Author: Brad King <brad.k...@kitware.com> AuthorDate: Wed Mar 1 11:55:51 2017 -0500 Commit: Brad King <brad.k...@kitware.com> CommitDate: Thu Mar 2 08:35:48 2017 -0500 cmOrderDirectories: Consider symlinks when checking implicit directories When checking whether a directory is "implicit" (e.g. implicit link directory or implicit rpath directory), resolve the real path of both sides of the comparison. Otherwise we will not recognize paths like `/usr/lib32` as implicit when `/usr/lib` is implicit and `lib32` is actually a symlink to `lib`. This can lead to addition of unnecessary entries to the RPATH of a binary, for example. Fixes: #16682 diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx index d93debe..d48eb53 100644 --- a/Source/cmOrderDirectories.cxx +++ b/Source/cmOrderDirectories.cxx @@ -345,12 +345,17 @@ void cmOrderDirectories::AddLanguageDirectories( void cmOrderDirectories::SetImplicitDirectories( std::set<std::string> const& implicitDirs) { - this->ImplicitDirectories = implicitDirs; + this->ImplicitDirectories.clear(); + for (std::set<std::string>::const_iterator i = implicitDirs.begin(); + i != implicitDirs.end(); ++i) { + this->ImplicitDirectories.insert(this->GetRealPath(*i)); + } } bool cmOrderDirectories::IsImplicitDirectory(std::string const& dir) { - return this->ImplicitDirectories.find(dir) != + std::string const& real = this->GetRealPath(dir); + return this->ImplicitDirectories.find(real) != this->ImplicitDirectories.end(); } ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/mailman/listinfo/cmake-commits