diff options
-rw-r--r-- | Modules/FindJNI.cmake | 6 | ||||
-rw-r--r-- | Modules/FindJava.cmake | 6 | ||||
-rw-r--r-- | Modules/UseJava.cmake | 2 | ||||
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/kwsys/SystemTools.cxx | 26 | ||||
-rw-r--r-- | Source/kwsys/testSystemTools.cxx | 188 |
6 files changed, 206 insertions, 24 deletions
diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake index cbe21d7..135038c 100644 --- a/Modules/FindJNI.cmake +++ b/Modules/FindJNI.cmake @@ -63,7 +63,7 @@ macro(java_append_library_directories _var) elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64") set(_java_libarch "ppc64" "ppc") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)") - set(_java_libarch "ppc") + set(_java_libarch "ppc" "ppc64") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc") # Both flavours can run on the same processor set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "sparc" "sparcv9") @@ -271,7 +271,8 @@ find_path(JAVA_INCLUDE_PATH jni.h ${JAVA_AWT_INCLUDE_DIRECTORIES} ) -find_path(JAVA_INCLUDE_PATH2 jni_md.h +find_path(JAVA_INCLUDE_PATH2 NAMES jni_md.h jniport.h + PATHS ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH}/darwin ${JAVA_INCLUDE_PATH}/win32 @@ -281,6 +282,7 @@ find_path(JAVA_INCLUDE_PATH2 jni_md.h ${JAVA_INCLUDE_PATH}/solaris ${JAVA_INCLUDE_PATH}/hp-ux ${JAVA_INCLUDE_PATH}/alpha + ${JAVA_INCLUDE_PATH}/aix ) find_path(JAVA_AWT_INCLUDE_PATH jawt.h diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake index 9f87997..cc67df6 100644 --- a/Modules/FindJava.cmake +++ b/Modules/FindJava.cmake @@ -228,12 +228,12 @@ if(Java_FIND_COMPONENTS) endif() elseif(component STREQUAL "IdlJ") list(APPEND _JAVA_REQUIRED_VARS Java_IDLJ_EXECUTABLE) - if(Java_IdlJ_EXECUTABLE) - set(Java_Extra_FOUND TRUE) + if(Java_IDLJ_EXECUTABLE) + set(Java_IdlJ_FOUND TRUE) endif() elseif(component STREQUAL "JarSigner") list(APPEND _JAVA_REQUIRED_VARS Java_JARSIGNER_EXECUTABLE) - if(Java_IDLJ_EXECUTABLE) + if(Java_JARSIGNER_EXECUTABLE) set(Java_JarSigner_FOUND TRUE) endif() else() diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index dced6ec..6146d78 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -444,7 +444,7 @@ function(add_jar _TARGET_NAME) if (_add_jar_MANIFEST) set(_MANIFEST_OPTION m) - set(_MANIFEST_VALUE ${_add_jar_MANIFEST}) + get_filename_component (_MANIFEST_VALUE "${_add_jar_MANIFEST}" ABSOLUTE) endif () if (LIBRARY_OUTPUT_PATH) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 81d33c2..21c4ab4 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 4) -set(CMake_VERSION_PATCH 20151204) +set(CMake_VERSION_PATCH 20151207) #set(CMake_VERSION_RC 1) diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 37fe421..82087f0 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -2402,8 +2402,7 @@ bool SystemTools::CopyFileAlways(const std::string& source, const std::string& d // name as the source in that directory. std::string destination_dir; - if(SystemTools::FileExists(destination) && - SystemTools::FileIsDirectory(destination)) + if(SystemTools::FileIsDirectory(destination)) { destination_dir = real_destination; SystemTools::ConvertToUnixSlashes(real_destination); @@ -2969,19 +2968,14 @@ std::string SystemTools::FindProgram( const std::vector<std::string>& userPaths, bool no_system_path) { - std::vector<std::string> extensions; std::string tryPath; #if defined (_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) - bool hasExtension = false; + std::vector<std::string> extensions; // check to see if the name already has a .xxx at // the end of it - if(name.size() > 3 && name[name.size()-4] == '.') - { - hasExtension = true; - } // on windows try .com then .exe - if(!hasExtension) + if(name.size() <= 3 || name[name.size()-4] != '.') { extensions.push_back(".com"); extensions.push_back(".exe"); @@ -2992,8 +2986,7 @@ std::string SystemTools::FindProgram( { tryPath = name; tryPath += *i; - if(SystemTools::FileExists(tryPath) && - !SystemTools::FileIsDirectory(tryPath)) + if(SystemTools::FileExists(tryPath, true)) { return SystemTools::CollapseFullPath(tryPath); } @@ -3002,11 +2995,9 @@ std::string SystemTools::FindProgram( #endif // now try just the name - tryPath = name; - if(SystemTools::FileExists(tryPath) && - !SystemTools::FileIsDirectory(tryPath)) + if(SystemTools::FileExists(name, true)) { - return SystemTools::CollapseFullPath(tryPath); + return SystemTools::CollapseFullPath(name); } // now construct the path std::vector<std::string> path; @@ -3043,6 +3034,7 @@ std::string SystemTools::FindProgram( // Remove double quotes from the path on windows SystemTools::ReplaceString(*p, "\"", ""); #endif +#if defined (_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) // first try with extensions for(std::vector<std::string>::iterator ext = extensions.begin(); ext != extensions.end(); ++ext) @@ -3055,6 +3047,7 @@ std::string SystemTools::FindProgram( return SystemTools::CollapseFullPath(tryPath); } } +#endif // now try it without them tryPath = *p; tryPath += name; @@ -3133,8 +3126,7 @@ std::string SystemTools tryPath = *p; tryPath += name; tryPath += ".framework"; - if(SystemTools::FileExists(tryPath) - && SystemTools::FileIsDirectory(tryPath)) + if(SystemTools::FileIsDirectory(tryPath)) { return SystemTools::CollapseFullPath(tryPath); } diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx index a0f904f..4d97688 100644 --- a/Source/kwsys/testSystemTools.cxx +++ b/Source/kwsys/testSystemTools.cxx @@ -172,6 +172,63 @@ static bool CheckFileOperations() << testNewDir << std::endl; res = false; } + // calling it again should just return true + if (!kwsys::SystemTools::MakeDirectory(testNewDir)) + { + std::cerr + << "Problem with second call to MakeDirectory for: " + << testNewDir << std::endl; + res = false; + } + // calling with 0 pointer should return false + if (kwsys::SystemTools::MakeDirectory(0)) + { + std::cerr + << "Problem with MakeDirectory(0)" + << std::endl; + res = false; + } + // calling with an empty string should return false + if (kwsys::SystemTools::MakeDirectory(std::string())) + { + std::cerr + << "Problem with MakeDirectory(std::string())" + << std::endl; + res = false; + } + // check existence + if (!kwsys::SystemTools::FileExists(testNewDir.c_str(), false)) + { + std::cerr + << "Problem with FileExists as C string and not file for: " + << testNewDir << std::endl; + res = false; + } + // remove it + if (!kwsys::SystemTools::RemoveADirectory(testNewDir)) + { + std::cerr + << "Problem with RemoveADirectory for: " + << testNewDir << std::endl; + res = false; + } + // check existence + if (kwsys::SystemTools::FileExists(testNewDir.c_str(), false)) + { + std::cerr + << "After RemoveADirectory: " + << "Problem with FileExists as C string and not file for: " + << testNewDir << std::endl; + res = false; + } + // create it using the char* version + if (!kwsys::SystemTools::MakeDirectory(testNewDir.c_str())) + { + std::cerr + << "Problem with second call to MakeDirectory as C string for: " + << testNewDir << std::endl; + res = false; + } if (!kwsys::SystemTools::Touch(testNewFile.c_str(), true)) { @@ -180,6 +237,97 @@ static bool CheckFileOperations() << testNewFile << std::endl; res = false; } + // calling MakeDirectory with something that is no file should fail + if (kwsys::SystemTools::MakeDirectory(testNewFile)) + { + std::cerr + << "Problem with to MakeDirectory for: " + << testNewFile << std::endl; + res = false; + } + + // calling with 0 pointer should return false + if (kwsys::SystemTools::FileExists(0)) + { + std::cerr + << "Problem with FileExists(0)" + << std::endl; + res = false; + } + if (kwsys::SystemTools::FileExists(0, true)) + { + std::cerr + << "Problem with FileExists(0) as file" + << std::endl; + res = false; + } + // calling with an empty string should return false + if (kwsys::SystemTools::FileExists(std::string())) + { + std::cerr + << "Problem with FileExists(std::string())" + << std::endl; + res = false; + } + // FileExists(x, true) should return false on a directory + if (kwsys::SystemTools::FileExists(testNewDir, true)) + { + std::cerr + << "Problem with FileExists as file for: " + << testNewDir << std::endl; + res = false; + } + if (kwsys::SystemTools::FileExists(testNewDir.c_str(), true)) + { + std::cerr + << "Problem with FileExists as C string and file for: " + << testNewDir << std::endl; + res = false; + } + // FileExists(x, false) should return true even on a directory + if (!kwsys::SystemTools::FileExists(testNewDir, false)) + { + std::cerr + << "Problem with FileExists as not file for: " + << testNewDir << std::endl; + res = false; + } + if (!kwsys::SystemTools::FileExists(testNewDir.c_str(), false)) + { + std::cerr + << "Problem with FileExists as C string and not file for: " + << testNewDir << std::endl; + res = false; + } + // should work, was created as new file before + if (!kwsys::SystemTools::FileExists(testNewFile)) + { + std::cerr + << "Problem with FileExists for: " + << testNewDir << std::endl; + res = false; + } + if (!kwsys::SystemTools::FileExists(testNewFile.c_str())) + { + std::cerr + << "Problem with FileExists as C string for: " + << testNewDir << std::endl; + res = false; + } + if (!kwsys::SystemTools::FileExists(testNewFile, true)) + { + std::cerr + << "Problem with FileExists as file for: " + << testNewDir << std::endl; + res = false; + } + if (!kwsys::SystemTools::FileExists(testNewFile.c_str(), true)) + { + std::cerr + << "Problem with FileExists as C string and file for: " + << testNewDir << std::endl; + res = false; + } // Reset umask #if defined(_WIN32) && !defined(__CYGWIN__) @@ -851,6 +999,44 @@ static bool CheckGetPath() return res; } +static bool CheckFind() +{ + bool res = true; + const std::string testFindFileName("testFindFile.txt"); + const std::string testFindFile(TEST_SYSTEMTOOLS_BINARY_DIR "/" + + testFindFileName); + + if (!kwsys::SystemTools::Touch(testFindFile.c_str(), true)) + { + std::cerr + << "Problem with Touch for: " + << testFindFile << std::endl; + // abort here as the existence of the file only makes the test meaningful + return false; + } + + std::vector<std::string> searchPaths; + searchPaths.push_back(TEST_SYSTEMTOOLS_BINARY_DIR); + if (kwsys::SystemTools::FindFile(testFindFileName, + searchPaths, true).empty()) + { + std::cerr + << "Problem with FindFile without system paths for: " + << testFindFileName << std::endl; + res = false; + } + if (kwsys::SystemTools::FindFile(testFindFileName, + searchPaths, false).empty()) + { + std::cerr + << "Problem with FindFile with system paths for: " + << testFindFileName << std::endl; + res = false; + } + + return res; +} + //---------------------------------------------------------------------------- int testSystemTools(int, char*[]) { @@ -888,5 +1074,7 @@ int testSystemTools(int, char*[]) res &= CheckGetPath(); + res &= CheckFind(); + return res ? 0 : 1; } |