[Cmake-commits] CMake branch, next, updated. v2.8.8-3545-g5a8c7aa
Brad King
brad.king at kitware.com
Fri Jul 20 14:21:29 EDT 2012
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 5a8c7aa1ebfc6a4df0bb269d68eed1bcb337e6b5 (commit)
via 733726edf61aa7889b57aa9490cb719c83d3ea0f (commit)
via 54add62f1b36ffc25f333762901e14b2def21db2 (commit)
via 6ca2f82d0d8dbb1f0f79c5fe1a4e21de78a57c84 (commit)
via 1fe4b82a45bfe3e578267d84c70d6e55610e2ced (commit)
from 928dfb0de2262b1ef317ca113b262222cee60519 (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 -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5a8c7aa1ebfc6a4df0bb269d68eed1bcb337e6b5
commit 5a8c7aa1ebfc6a4df0bb269d68eed1bcb337e6b5
Merge: 928dfb0 733726e
Author: Brad King <brad.king at kitware.com>
AuthorDate: Fri Jul 20 14:21:26 2012 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Jul 20 14:21:26 2012 -0400
Merge topic 'mixed-lib-to-lib64' into next
733726e find_library: Fix mixed lib->lib64 (non-)conversion cases (#13419)
54add62 find_library: Simplify lib->lib<arch> expansion
6ca2f82 find_library: Refactor lib->lib64 conversion
1fe4b82 find_library: Add test covering lib->lib64 cases
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=733726edf61aa7889b57aa9490cb719c83d3ea0f
commit 733726edf61aa7889b57aa9490cb719c83d3ea0f
Author: Brad King <brad.king at kitware.com>
AuthorDate: Fri Jul 20 14:09:57 2012 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Fri Jul 20 14:19:11 2012 -0400
find_library: Fix mixed lib->lib64 (non-)conversion cases (#13419)
When a search path contains multiple "lib/" instances we previously
converted all or none. This fails for cases where only some of the
multiple instances must be converted. Teach AddArchitecturePaths to
generate all combinations that exist. Uncomment these cases in the
CMakeOnly.find_library test now that they work.
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index 06216cd..652e697 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -134,32 +134,51 @@ void cmFindLibraryCommand::AddArchitecturePaths(const char* suffix)
{
std::vector<std::string> original;
original.swap(this->SearchPaths);
- std::string subpath = "lib";
- subpath += suffix;
- subpath += "/";
for(std::vector<std::string>::iterator i = original.begin();
i != original.end(); ++i)
{
- // Try replacing lib/ with lib<suffix>/
- std::string s = *i;
- cmSystemTools::ReplaceString(s, "lib/", subpath.c_str());
- if((s != *i) && cmSystemTools::FileIsDirectory(s.c_str()))
+ this->AddArchitecturePath(*i, 0, suffix);
+ }
+}
+
+//----------------------------------------------------------------------------
+void cmFindLibraryCommand::AddArchitecturePath(
+ std::string const& dir, std::string::size_type start_pos,
+ const char* suffix, bool fresh)
+{
+ std::string::size_type pos = dir.find("lib/", start_pos);
+ if(pos != std::string::npos)
+ {
+ std::string cur_dir = dir.substr(0,pos+3);
+
+ // Follow "lib<suffix>".
+ std::string next_dir = cur_dir + suffix;
+ if(cmSystemTools::FileIsDirectory(next_dir.c_str()))
{
- this->SearchPaths.push_back(s);
+ next_dir += dir.substr(pos+3);
+ std::string::size_type next_pos = pos+3+strlen(suffix)+1;
+ this->AddArchitecturePath(next_dir, next_pos, suffix);
}
- // Now look for <original><suffix>/
- s = *i;
- s += suffix;
- s += "/";
- if(cmSystemTools::FileIsDirectory(s.c_str()))
+ // Follow "lib".
+ if(cmSystemTools::FileIsDirectory(cur_dir.c_str()))
+ {
+ this->AddArchitecturePath(dir, pos+3+1, suffix, false);
+ }
+ }
+ if(fresh)
+ {
+ // Check for <dir><suffix>/.
+ std::string cur_dir = dir + suffix + "/";
+ if(cmSystemTools::FileIsDirectory(cur_dir.c_str()))
{
- this->SearchPaths.push_back(s);
+ this->SearchPaths.push_back(cur_dir);
}
+
// Now add the original unchanged path
- if(cmSystemTools::FileIsDirectory(i->c_str()))
+ if(cmSystemTools::FileIsDirectory(dir.c_str()))
{
- this->SearchPaths.push_back(*i);
+ this->SearchPaths.push_back(dir);
}
}
}
diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h
index f91583b..31a5c3f 100644
--- a/Source/cmFindLibraryCommand.h
+++ b/Source/cmFindLibraryCommand.h
@@ -62,6 +62,10 @@ public:
protected:
void AddArchitecturePaths(const char* suffix);
+ void AddArchitecturePath(std::string const& dir,
+ std::string::size_type start_pos,
+ const char* suffix,
+ bool fresh = true);
std::string FindLibrary();
virtual void GenerateDocumentation();
private:
diff --git a/Tests/CMakeOnly/find_library/CMakeLists.txt b/Tests/CMakeOnly/find_library/CMakeLists.txt
index 1938896..08f9331 100644
--- a/Tests/CMakeOnly/find_library/CMakeLists.txt
+++ b/Tests/CMakeOnly/find_library/CMakeLists.txt
@@ -50,9 +50,9 @@ endforeach()
set(CMAKE_SIZEOF_VOID_P 8)
foreach(lib64
lib/64/libtest2.a
- #lib/A/lib64/libtest3.a # known breakage
+ lib/A/lib64/libtest3.a
lib/libtest3.a
- #lib64/A/lib/libtest2.a # known breakage
+ lib64/A/lib/libtest2.a
lib64/A/lib64/libtest1.a
lib64/A/libtest1.a
lib64/libtest1.a
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=54add62f1b36ffc25f333762901e14b2def21db2
commit 54add62f1b36ffc25f333762901e14b2def21db2
Author: Brad King <brad.king at kitware.com>
AuthorDate: Fri Jul 20 13:30:30 2012 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Fri Jul 20 14:19:10 2012 -0400
find_library: Simplify lib->lib<arch> expansion
Simplify cmFindLibraryCommand::AddArchitecturePaths logic to avoid
recording a separate 'found' status and populating an entire
vector<string> just to throw it away.
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index 688d8a7..06216cd 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -132,44 +132,36 @@ bool cmFindLibraryCommand
//----------------------------------------------------------------------------
void cmFindLibraryCommand::AddArchitecturePaths(const char* suffix)
{
- std::vector<std::string> newPaths;
- bool found = false;
+ std::vector<std::string> original;
+ original.swap(this->SearchPaths);
std::string subpath = "lib";
subpath += suffix;
subpath += "/";
- for(std::vector<std::string>::iterator i = this->SearchPaths.begin();
- i != this->SearchPaths.end(); ++i)
+ for(std::vector<std::string>::iterator i = original.begin();
+ i != original.end(); ++i)
{
// Try replacing lib/ with lib<suffix>/
std::string s = *i;
cmSystemTools::ReplaceString(s, "lib/", subpath.c_str());
if((s != *i) && cmSystemTools::FileIsDirectory(s.c_str()))
{
- found = true;
- newPaths.push_back(s);
+ this->SearchPaths.push_back(s);
}
- // Now look for lib<suffix>
+ // Now look for <original><suffix>/
s = *i;
s += suffix;
s += "/";
if(cmSystemTools::FileIsDirectory(s.c_str()))
{
- found = true;
- newPaths.push_back(s);
+ this->SearchPaths.push_back(s);
}
- // now add the original unchanged path
+ // Now add the original unchanged path
if(cmSystemTools::FileIsDirectory(i->c_str()))
{
- newPaths.push_back(*i);
+ this->SearchPaths.push_back(*i);
}
}
-
- // If any new paths were found replace the original set.
- if(found)
- {
- this->SearchPaths = newPaths;
- }
}
//----------------------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6ca2f82d0d8dbb1f0f79c5fe1a4e21de78a57c84
commit 6ca2f82d0d8dbb1f0f79c5fe1a4e21de78a57c84
Author: Brad King <brad.king at kitware.com>
AuthorDate: Fri Jul 20 13:28:49 2012 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Fri Jul 20 14:19:08 2012 -0400
find_library: Refactor lib->lib64 conversion
Previously methods AddArchitecturePaths and AddLib64Paths were almost
identical. Replace the latter with a call to the former. Fix the
AddArchitecturePaths implementation to add trailing slashes to all
tested paths.
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index 6cdbbf2..688d8a7 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -105,7 +105,10 @@ bool cmFindLibraryCommand
->GetPropertyAsBool("FIND_LIBRARY_USE_LIB64_PATHS"))
{
// add special 64 bit paths if this is a 64 bit compile.
- this->AddLib64Paths();
+ if(this->Makefile->PlatformIs64Bit())
+ {
+ this->AddArchitecturePaths("64");
+ }
}
std::string library = this->FindLibrary();
@@ -149,6 +152,7 @@ void cmFindLibraryCommand::AddArchitecturePaths(const char* suffix)
// Now look for lib<suffix>
s = *i;
s += suffix;
+ s += "/";
if(cmSystemTools::FileIsDirectory(s.c_str()))
{
found = true;
@@ -168,53 +172,6 @@ void cmFindLibraryCommand::AddArchitecturePaths(const char* suffix)
}
}
-void cmFindLibraryCommand::AddLib64Paths()
-{
- std::string voidsize =
- this->Makefile->GetSafeDefinition("CMAKE_SIZEOF_VOID_P");
- int size = atoi(voidsize.c_str());
- if(size != 8)
- {
- return;
- }
- std::vector<std::string> path64;
- bool found64 = false;
- for(std::vector<std::string>::iterator i = this->SearchPaths.begin();
- i != this->SearchPaths.end(); ++i)
- {
- std::string s = *i;
- std::string s2 = *i;
- cmSystemTools::ReplaceString(s, "lib/", "lib64/");
- // try to replace lib with lib64 and see if it is there,
- // then prepend it to the path
- // Note that all paths have trailing slashes.
- if((s != *i) && cmSystemTools::FileIsDirectory(s.c_str()))
- {
- path64.push_back(s);
- found64 = true;
- }
- // now just add a 64 to the path name and if it is there,
- // add it to the path
- s2 += "64/";
- if(cmSystemTools::FileIsDirectory(s2.c_str()))
- {
- found64 = true;
- path64.push_back(s2);
- }
- // now add the original unchanged path
- if(cmSystemTools::FileIsDirectory(i->c_str()))
- {
- path64.push_back(*i);
- }
- }
- // now replace the SearchPaths with the 64 bit converted path
- // if any 64 bit paths were discovered
- if(found64)
- {
- this->SearchPaths = path64;
- }
-}
-
//----------------------------------------------------------------------------
std::string cmFindLibraryCommand::FindLibrary()
{
diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h
index b880be2..f91583b 100644
--- a/Source/cmFindLibraryCommand.h
+++ b/Source/cmFindLibraryCommand.h
@@ -62,7 +62,6 @@ public:
protected:
void AddArchitecturePaths(const char* suffix);
- void AddLib64Paths();
std::string FindLibrary();
virtual void GenerateDocumentation();
private:
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1fe4b82a45bfe3e578267d84c70d6e55610e2ced
commit 1fe4b82a45bfe3e578267d84c70d6e55610e2ced
Author: Brad King <brad.king at kitware.com>
AuthorDate: Fri Jul 20 10:19:16 2012 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Fri Jul 20 14:19:07 2012 -0400
find_library: Add test covering lib->lib64 cases
Add a "CMakeOnly.find_library" test covering various cases involving
lib->lib64 (non-)conversion. Comment out cases involving mixed path
components "lib" and "lib64", such as lib/A/lib64 and lib64/A/lib, as
these are known to be broken currently.
diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt
index a1551ca..6fe91c7 100644
--- a/Tests/CMakeOnly/CMakeLists.txt
+++ b/Tests/CMakeOnly/CMakeLists.txt
@@ -23,6 +23,8 @@ add_CMakeOnly_test(AllFindModules)
add_CMakeOnly_test(TargetScope)
+add_CMakeOnly_test(find_library)
+
add_test(CMakeOnly.ProjectInclude ${CMAKE_CMAKE_COMMAND}
-DTEST=ProjectInclude
-DCMAKE_ARGS=-DCMAKE_PROJECT_ProjectInclude_INCLUDE=${CMAKE_CURRENT_SOURCE_DIR}/ProjectInclude/include.cmake
diff --git a/Tests/CMakeOnly/find_library/CMakeLists.txt b/Tests/CMakeOnly/find_library/CMakeLists.txt
new file mode 100644
index 0000000..1938896
--- /dev/null
+++ b/Tests/CMakeOnly/find_library/CMakeLists.txt
@@ -0,0 +1,61 @@
+cmake_minimum_required(VERSION 2.8)
+project(FindLibraryTest NONE)
+
+set(CMAKE_FIND_DEBUG_MODE 1)
+
+macro(test_find_library expected)
+ get_filename_component(dir ${expected} PATH)
+ get_filename_component(name ${expected} NAME)
+ string(REGEX REPLACE "lib/?64" "lib" dir "${dir}")
+ unset(LIB CACHE)
+ find_library(LIB
+ NAMES ${name}
+ PATHS ${CMAKE_CURRENT_SOURCE_DIR}/${dir}
+ NO_DEFAULT_PATH
+ )
+ if(LIB)
+ # Convert to relative path for comparison to expected location.
+ file(RELATIVE_PATH REL_LIB "${CMAKE_CURRENT_SOURCE_DIR}" "${LIB}")
+
+ # Debugging output.
+ if(CMAKE_FIND_DEBUG_MODE)
+ message(STATUS "Library ${expected} searched as ${dir}, found as [${REL_LIB}].")
+ endif()
+
+ # Check and report failure.
+ if(NOT "${REL_LIB}" STREQUAL "${expected}")
+ message(SEND_ERROR "Library ${l} should have been [${expected}] but was [${REL_LIB}]")
+ endif()
+ else()
+ message(SEND_ERROR "Library ${expected} searched as ${dir}, NOT FOUND!")
+ endif()
+endmacro()
+
+set(CMAKE_FIND_LIBRARY_PREFIXES "lib")
+set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
+set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE)
+
+set(CMAKE_SIZEOF_VOID_P 4)
+foreach(lib
+ lib/A/lib/libtest1.a
+ lib/A/libtest1.a
+ lib/libtest1.a
+ lib/libtest2.a
+ lib/libtest3.a
+ lib/libtest3.a
+ )
+ test_find_library(${lib})
+endforeach()
+
+set(CMAKE_SIZEOF_VOID_P 8)
+foreach(lib64
+ lib/64/libtest2.a
+ #lib/A/lib64/libtest3.a # known breakage
+ lib/libtest3.a
+ #lib64/A/lib/libtest2.a # known breakage
+ lib64/A/lib64/libtest1.a
+ lib64/A/libtest1.a
+ lib64/libtest1.a
+ )
+ test_find_library(${lib64})
+endforeach()
diff --git a/Tests/CMakeOnly/find_library/lib/64/libtest2.a b/Tests/CMakeOnly/find_library/lib/64/libtest2.a
new file mode 100644
index 0000000..e69de29
diff --git a/Tests/CMakeOnly/find_library/lib/A/lib/libtest1.a b/Tests/CMakeOnly/find_library/lib/A/lib/libtest1.a
new file mode 100644
index 0000000..e69de29
diff --git a/Tests/CMakeOnly/find_library/lib/A/lib64/libtest3.a b/Tests/CMakeOnly/find_library/lib/A/lib64/libtest3.a
new file mode 100644
index 0000000..e69de29
diff --git a/Tests/CMakeOnly/find_library/lib/A/libtest1.a b/Tests/CMakeOnly/find_library/lib/A/libtest1.a
new file mode 100644
index 0000000..e69de29
diff --git a/Tests/CMakeOnly/find_library/lib/libtest1.a b/Tests/CMakeOnly/find_library/lib/libtest1.a
new file mode 100644
index 0000000..e69de29
diff --git a/Tests/CMakeOnly/find_library/lib/libtest2.a b/Tests/CMakeOnly/find_library/lib/libtest2.a
new file mode 100644
index 0000000..e69de29
diff --git a/Tests/CMakeOnly/find_library/lib/libtest3.a b/Tests/CMakeOnly/find_library/lib/libtest3.a
new file mode 100644
index 0000000..e69de29
diff --git a/Tests/CMakeOnly/find_library/lib64/A/lib/libtest2.a b/Tests/CMakeOnly/find_library/lib64/A/lib/libtest2.a
new file mode 100644
index 0000000..e69de29
diff --git a/Tests/CMakeOnly/find_library/lib64/A/lib64/libtest1.a b/Tests/CMakeOnly/find_library/lib64/A/lib64/libtest1.a
new file mode 100644
index 0000000..e69de29
diff --git a/Tests/CMakeOnly/find_library/lib64/A/libtest1.a b/Tests/CMakeOnly/find_library/lib64/A/libtest1.a
new file mode 100644
index 0000000..e69de29
diff --git a/Tests/CMakeOnly/find_library/lib64/libtest1.a b/Tests/CMakeOnly/find_library/lib64/libtest1.a
new file mode 100644
index 0000000..e69de29
-----------------------------------------------------------------------
Summary of changes:
Source/cmFindLibraryCommand.cxx | 114 +++++++-------------
Source/cmFindLibraryCommand.h | 5 +-
Tests/CMakeOnly/CMakeLists.txt | 2 +
Tests/CMakeOnly/find_library/CMakeLists.txt | 61 +++++++++++
.../CMakeOnly/find_library/lib/64/libtest2.a | 0
.../CMakeOnly/find_library/lib/A/lib/libtest1.a | 0
.../CMakeOnly/find_library/lib/A/lib64/libtest3.a | 0
.../CMakeOnly/find_library/lib/A/libtest1.a | 0
.../CMakeOnly/find_library/lib/libtest1.a | 0
.../CMakeOnly/find_library/lib/libtest2.a | 0
.../CMakeOnly/find_library/lib/libtest3.a | 0
.../CMakeOnly/find_library/lib64/A/lib/libtest2.a | 0
.../find_library/lib64/A/lib64/libtest1.a | 0
.../CMakeOnly/find_library/lib64/A/libtest1.a | 0
.../CMakeOnly/find_library/lib64/libtest1.a | 0
15 files changed, 108 insertions(+), 74 deletions(-)
create mode 100644 Tests/CMakeOnly/find_library/CMakeLists.txt
copy Modules/IntelVSImplicitPath/hello.f => Tests/CMakeOnly/find_library/lib/64/libtest2.a (100%)
copy Modules/IntelVSImplicitPath/hello.f => Tests/CMakeOnly/find_library/lib/A/lib/libtest1.a (100%)
copy Modules/IntelVSImplicitPath/hello.f => Tests/CMakeOnly/find_library/lib/A/lib64/libtest3.a (100%)
copy Modules/IntelVSImplicitPath/hello.f => Tests/CMakeOnly/find_library/lib/A/libtest1.a (100%)
copy Modules/IntelVSImplicitPath/hello.f => Tests/CMakeOnly/find_library/lib/libtest1.a (100%)
copy Modules/IntelVSImplicitPath/hello.f => Tests/CMakeOnly/find_library/lib/libtest2.a (100%)
copy Modules/IntelVSImplicitPath/hello.f => Tests/CMakeOnly/find_library/lib/libtest3.a (100%)
copy Modules/IntelVSImplicitPath/hello.f => Tests/CMakeOnly/find_library/lib64/A/lib/libtest2.a (100%)
copy Modules/IntelVSImplicitPath/hello.f => Tests/CMakeOnly/find_library/lib64/A/lib64/libtest1.a (100%)
copy Modules/IntelVSImplicitPath/hello.f => Tests/CMakeOnly/find_library/lib64/A/libtest1.a (100%)
copy Modules/IntelVSImplicitPath/hello.f => Tests/CMakeOnly/find_library/lib64/libtest1.a (100%)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list