diff options
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | ChangeLog.manual | 6 | ||||
-rw-r--r-- | Source/CMakeLists.txt | 13 | ||||
-rw-r--r-- | Source/cmGlobalUnixMakefileGenerator3.h | 3 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmMakefileExecutableTargetGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmMakefileLibraryTargetGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 10 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.h | 4 | ||||
-rw-r--r-- | Source/cmMakefileUtilityTargetGenerator.cxx | 13 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 2 | ||||
-rw-r--r-- | Tests/CustComDepend/CMakeLists.txt | 13 | ||||
-rw-r--r-- | Tests/CustComDepend/bar.h | 9 | ||||
-rw-r--r-- | Tests/CustComDepend/foo.cxx | 15 |
14 files changed, 86 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 081a8ee0c0..afccbf0c1c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,9 +5,9 @@ MARK_AS_ADVANCED(CMAKE_BACKWARDS_COMPATIBILITY) # The CMake version number. SET(CMake_VERSION_MAJOR 2) SET(CMake_VERSION_MINOR 4) -SET(CMake_VERSION_PATCH 5) +SET(CMake_VERSION_PATCH 6) # for an actual release this should not be defined -#SET(CMake_VERSION_RC 4) +SET(CMake_VERSION_RC 1) SET(CMake_VERSION "${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") SET(CMake_VERSION_FULL "${CMake_VERSION}.${CMake_VERSION_PATCH}") diff --git a/ChangeLog.manual b/ChangeLog.manual index 3024e43105..9b2d54ed79 100644 --- a/ChangeLog.manual +++ b/ChangeLog.manual @@ -1,3 +1,9 @@ +Changes in CMake 2.4.6 +* Fix for finding custom commands from a full path with CMAKE_CFG_INTDIR. + +* Fix for Borland make and custom commands that do nothing + + Changes in CMake 2.4.5 * Fix for seg fault when a macro runs a bad command BUG# 3815 diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 694ba9dd90..19f56a8a0e 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -402,6 +402,7 @@ IF(BUILD_TESTING) --test-command ${CMAKE_CMAKE_COMMAND} -E compare_files ${CMake_SOURCE_DIR}/Tests/TargetName/scripts/hello_world ${CMake_BINARY_DIR}/Tests/TargetName/scripts/hello_world) + ADD_TEST(LibName ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/LibName" @@ -414,6 +415,18 @@ IF(BUILD_TESTING) --test-command foobar ) + ADD_TEST(CustComDepend ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/CustComDepend" + "${CMake_BINARY_DIR}/Tests/CustComDepend" + --build-two-config + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + --build-project CustComDepend + --build-exe-dir "${CMake_BINARY_DIR}/Tests/CustComDepend/bin" + --test-command foo bar.c + ) + ADD_TEST(CustomCommand ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/CustomCommand" diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index f07451073e..7bf675cffa 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -115,6 +115,9 @@ public: no rule. This is used for multiple output dependencies. */ std::string GetEmptyCommandHack() { return this->EmptyCommandsHack; } + /** Get the fake dependency to use when a rule has no real commands + or dependencies. */ + std::string GetEmptyRuleHackDepends() { return this->EmptyRuleHackDepends; } // change the build command for speed virtual std::string GenerateBuildCommand diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 7afdb31c20..27fdf108ef 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1865,6 +1865,8 @@ std::string cmLocalGenerator::GetRealDependency(const char* inName, tLocation = cmSystemTools::GetFilenamePath(tLocation); std::string depLocation = cmSystemTools::GetFilenamePath( std::string(inName)); + depLocation = cmSystemTools::CollapseFullPath(depLocation.c_str()); + tLocation = cmSystemTools::CollapseFullPath(tLocation.c_str()); if(depLocation != tLocation) { // it is a full path to a depend that has the same name diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 5905f84903..7096dbf1a4 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -17,7 +17,7 @@ #include "cmMakefileExecutableTargetGenerator.h" #include "cmGeneratedFileStream.h" -#include "cmGlobalGenerator.h" +#include "cmGlobalUnixMakefileGenerator3.h" #include "cmLocalUnixMakefileGenerator3.h" #include "cmMakefile.h" #include "cmSourceFile.h" diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 9c3b973bda..5bc030abca 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -17,7 +17,7 @@ #include "cmMakefileLibraryTargetGenerator.h" #include "cmGeneratedFileStream.h" -#include "cmGlobalGenerator.h" +#include "cmGlobalUnixMakefileGenerator3.h" #include "cmLocalUnixMakefileGenerator3.h" #include "cmMakefile.h" #include "cmSourceFile.h" diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index ecc46998de..30824950ff 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -65,7 +65,8 @@ cmMakefileTargetGenerator::New(cmLocalUnixMakefileGenerator3 *lg, result->TargetName = tgtName; result->Target = tgt; result->LocalGenerator = lg; - result->GlobalGenerator = lg->GetGlobalGenerator(); + result->GlobalGenerator = + static_cast<cmGlobalUnixMakefileGenerator3*>(lg->GetGlobalGenerator()); result->Makefile = lg->GetMakefile(); return result; } @@ -891,9 +892,7 @@ void cmMakefileTargetGenerator depends.clear(); depends.push_back(*o); commands.clear(); - cmGlobalUnixMakefileGenerator3* gg = - static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator); - std::string emptyCommand = gg->GetEmptyCommandHack(); + std::string emptyCommand = this->GlobalGenerator->GetEmptyCommandHack(); if(!emptyCommand.empty()) { commands.push_back(emptyCommand); @@ -911,7 +910,8 @@ void cmMakefileTargetGenerator this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, o->c_str(), depends, commands, symbolic); - gg->AddMultipleOutputPair(o->c_str(), depends[0].c_str()); + this->GlobalGenerator->AddMultipleOutputPair(o->c_str(), + depends[0].c_str()); } } diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index dd6bbe62f6..fb6562be95 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -23,7 +23,7 @@ class cmCustomCommand; class cmDependInformation; class cmDepends; class cmGeneratedFileStream; -class cmGlobalGenerator; +class cmGlobalUnixMakefileGenerator3; class cmLocalUnixMakefileGenerator3; class cmMakeDepend; class cmMakefile; @@ -121,7 +121,7 @@ protected: cmStdString TargetName; cmTarget *Target; cmLocalUnixMakefileGenerator3 *LocalGenerator; - cmGlobalGenerator *GlobalGenerator; + cmGlobalUnixMakefileGenerator3 *GlobalGenerator; cmMakefile *Makefile; bool DriveCustomCommandsOnDepends; diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx index 51a848feec..6ab18631fd 100644 --- a/Source/cmMakefileUtilityTargetGenerator.cxx +++ b/Source/cmMakefileUtilityTargetGenerator.cxx @@ -17,7 +17,7 @@ #include "cmMakefileUtilityTargetGenerator.h" #include "cmGeneratedFileStream.h" -#include "cmGlobalGenerator.h" +#include "cmGlobalUnixMakefileGenerator3.h" #include "cmLocalUnixMakefileGenerator3.h" #include "cmMakefile.h" #include "cmSourceFile.h" @@ -58,6 +58,17 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles() objTarget += this->BuildFileName; this->LocalGenerator->AppendRuleDepend(depends, objTarget.c_str()); + // If the rule is empty add the special empty rule dependency needed + // by some make tools. + if(depends.empty() && commands.empty()) + { + std::string hack = this->GlobalGenerator->GetEmptyRuleHackDepends(); + if(!hack.empty()) + { + depends.push_back(hack); + } + } + // Write the rule. this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, this->Target->GetName(), diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 80031f4f8d..1509c14727 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -253,6 +253,8 @@ void cmTarget::TraceVSDependencies(std::string projFile, tLocation = cmSystemTools::GetFilenamePath(tLocation); std::string depLocation = cmSystemTools::GetFilenamePath( std::string(fullName)); + depLocation = cmSystemTools::CollapseFullPath(depLocation.c_str()); + tLocation = cmSystemTools::CollapseFullPath(tLocation.c_str()); if(depLocation == tLocation) { isUtility = true; diff --git a/Tests/CustComDepend/CMakeLists.txt b/Tests/CustComDepend/CMakeLists.txt new file mode 100644 index 0000000000..e4a3325744 --- /dev/null +++ b/Tests/CustComDepend/CMakeLists.txt @@ -0,0 +1,13 @@ +project(CustComDepend) +include_directories("${CustComDepend_SOURCE_DIR}") +add_definitions(-D_CRT_SECURE_NO_DEPRECATE=1) +set(EXECUTABLE_OUTPUT_PATH ${CustComDepend_BINARY_DIR}/bin) +add_executable(foo foo.cxx) +add_custom_command( + OUTPUT ${CustComDepend_BINARY_DIR}/bar.c + COMMAND ${CustComDepend_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/foo + ${CustComDepend_BINARY_DIR}/bar.c + DEPENDS ${CustComDepend_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/foo +) + +add_library(bar SHARED ${CustComDepend_BINARY_DIR}/bar.c) diff --git a/Tests/CustComDepend/bar.h b/Tests/CustComDepend/bar.h new file mode 100644 index 0000000000..d462c9b5bd --- /dev/null +++ b/Tests/CustComDepend/bar.h @@ -0,0 +1,9 @@ +#ifdef _WIN32 +# ifdef bar_EXPORTS +# define BAR_EXPORT __declspec( dllexport ) +# else +# define BAR_EXPORT __declspec( dllimport ) +# endif +#else +# define BAR_EXPORT +#endif diff --git a/Tests/CustComDepend/foo.cxx b/Tests/CustComDepend/foo.cxx new file mode 100644 index 0000000000..3c204f8a2d --- /dev/null +++ b/Tests/CustComDepend/foo.cxx @@ -0,0 +1,15 @@ +#include <stdio.h> + +int main(int ac, char** av) +{ + FILE* fout = fopen(av[1], "w"); + printf("create %s\n", av[1]); + if(!fout) + { + return -1; + } + fprintf(fout, "#include <bar.h>\nBAR_EXPORT int bar(){ return 10;}\n"); + fclose(fout); + return 0; +} + |