diff options
-rw-r--r-- | Modules/FindVulkan.cmake | 8 | ||||
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/cmOrderDirectories.cxx | 22 | ||||
-rw-r--r-- | Source/cmOrderDirectories.h | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/RunCMake/RuntimePath/A.c | 4 | ||||
-rw-r--r-- | Tests/RunCMake/RuntimePath/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/RunCMake/RuntimePath/RunCMakeTest.cmake | 18 | ||||
-rw-r--r-- | Tests/RunCMake/RuntimePath/SymlinkImplicit.cmake | 17 | ||||
-rw-r--r-- | Tests/RunCMake/RuntimePath/SymlinkImplicitCheck-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/RuntimePath/SymlinkImplicitCheck-stderr.txt | 22 | ||||
-rw-r--r-- | Tests/RunCMake/RuntimePath/SymlinkImplicitCheck.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/RuntimePath/main.c | 4 |
13 files changed, 98 insertions, 10 deletions
diff --git a/Modules/FindVulkan.cmake b/Modules/FindVulkan.cmake index 820e0eb..0be9f97 100644 --- a/Modules/FindVulkan.cmake +++ b/Modules/FindVulkan.cmake @@ -39,12 +39,16 @@ if(WIN32) find_library(Vulkan_LIBRARY NAMES vulkan-1 PATHS - "$ENV{VULKAN_SDK}/Bin") + "$ENV{VULKAN_SDK}/Lib" + "$ENV{VULKAN_SDK}/Bin" + ) elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) find_library(Vulkan_LIBRARY NAMES vulkan-1 PATHS - "$ENV{VULKAN_SDK}/Bin32") + "$ENV{VULKAN_SDK}/Lib32" + "$ENV{VULKAN_SDK}/Bin32" + ) endif() else() find_path(Vulkan_INCLUDE_DIR diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 62324e8..8ae92ea 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 8) -set(CMake_VERSION_PATCH 20170302) +set(CMake_VERSION_PATCH 20170303) #set(CMake_VERSION_RC 1) diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx index 7744a5a..d48eb53 100644 --- a/Source/cmOrderDirectories.cxx +++ b/Source/cmOrderDirectories.cxx @@ -287,8 +287,7 @@ void cmOrderDirectories::AddRuntimeLibrary(std::string const& fullPath, } } - if (this->ImplicitDirectories.find(dir) != - this->ImplicitDirectories.end()) { + if (this->IsImplicitDirectory(dir)) { this->ImplicitDirEntries.push_back( new cmOrderDirectoriesConstraintSOName(this, fullPath, soname)); return; @@ -316,8 +315,7 @@ void cmOrderDirectories::AddLinkLibrary(std::string const& fullPath) // Implicit link directories need special handling. if (!this->ImplicitDirectories.empty()) { std::string dir = cmSystemTools::GetFilenamePath(fullPath); - if (this->ImplicitDirectories.find(dir) != - this->ImplicitDirectories.end()) { + if (this->IsImplicitDirectory(dir)) { this->ImplicitDirEntries.push_back( new cmOrderDirectoriesConstraintLibrary(this, fullPath)); return; @@ -347,7 +345,18 @@ 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) +{ + std::string const& real = this->GetRealPath(dir); + return this->ImplicitDirectories.find(real) != + this->ImplicitDirectories.end(); } void cmOrderDirectories::SetLinkExtensionInfo( @@ -394,8 +403,7 @@ void cmOrderDirectories::AddOriginalDirectories( for (std::vector<std::string>::const_iterator di = dirs.begin(); di != dirs.end(); ++di) { // We never explicitly specify implicit link directories. - if (this->ImplicitDirectories.find(*di) != - this->ImplicitDirectories.end()) { + if (this->IsImplicitDirectory(*di)) { continue; } diff --git a/Source/cmOrderDirectories.h b/Source/cmOrderDirectories.h index 90a67e7..d9e0126 100644 --- a/Source/cmOrderDirectories.h +++ b/Source/cmOrderDirectories.h @@ -82,6 +82,8 @@ private: // Compare directories after resolving symlinks. bool IsSameDirectory(std::string const& l, std::string const& r); + bool IsImplicitDirectory(std::string const& dir); + std::string const& GetRealPath(std::string const& dir); std::map<std::string, std::string> RealPaths; diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 6423bfd..5157b9f 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -156,6 +156,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; +} |