diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2006-02-28 13:23:40 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2006-02-28 13:23:40 (GMT) |
commit | 36d7f3990aa1341ffa7782bea6e3b3233a3581ff (patch) | |
tree | d5d304ae64852ed6790eedf05f38cceede60d93c | |
parent | 456c823ec010ce379cdc85ace65fe1ddbeea3236 (diff) | |
download | CMake-36d7f3990aa1341ffa7782bea6e3b3233a3581ff.zip CMake-36d7f3990aa1341ffa7782bea6e3b3233a3581ff.tar.gz CMake-36d7f3990aa1341ffa7782bea6e3b3233a3581ff.tar.bz2 |
ENH: Add support for multiple build targets and start adding simple cpack tests
-rw-r--r-- | Source/CTest/cmCTestBuildAndTestHandler.cxx | 49 | ||||
-rw-r--r-- | Source/CTest/cmCTestBuildAndTestHandler.h | 2 | ||||
-rw-r--r-- | Tests/SimpleInstall/CMakeLists.txt | 9 | ||||
-rw-r--r-- | Tests/SimpleInstallS2/CMakeLists.txt | 9 |
4 files changed, 53 insertions, 16 deletions
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index a32d2e6..68c2350 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -34,6 +34,9 @@ cmCTestBuildAndTestHandler::cmCTestBuildAndTestHandler() //---------------------------------------------------------------------- void cmCTestBuildAndTestHandler::Initialize() { +#undef cout + std::cout << "Erase the list" << std::endl; std::cout.flush(); + m_BuildTargets.erase(m_BuildTargets.begin(), m_BuildTargets.end()); this->Superclass::Initialize(); } @@ -179,25 +182,41 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) } // do the build - std::string output; - retVal = cm.GetGlobalGenerator()->Build( - m_SourceDir.c_str(), m_BinaryDir.c_str(), - m_BuildProject.c_str(), m_BuildTarget.c_str(), - &output, m_BuildMakeProgram.c_str(), - m_CTest->GetConfigType().c_str(),!m_BuildNoClean); - - out << output; + std::vector<std::string>::iterator tarIt; +#undef cout + if ( m_BuildTargets.size() == 0 ) + { + m_BuildTargets.push_back(""); + } + std::cout << "Execute targets: " << std::endl; + for ( tarIt = m_BuildTargets.begin(); tarIt != m_BuildTargets.end(); + ++ tarIt ) + { + std::cout << "Execute targets: " << tarIt->c_str() << std::endl; + std::cout.flush(); + std::string output; + retVal = cm.GetGlobalGenerator()->Build( + m_SourceDir.c_str(), m_BinaryDir.c_str(), + m_BuildProject.c_str(), tarIt->c_str(), + &output, m_BuildMakeProgram.c_str(), + m_CTest->GetConfigType().c_str(),!m_BuildNoClean); + + out << output; + // if the build failed then return + if (retVal) + { + if(outstring) + { + *outstring = out.str(); + } + return 1; + } + } if(outstring) { *outstring = out.str(); } - // if the build failed then return - if (retVal) - { - return 1; - } - // if not test was specified then we are done if (!m_TestCommand.size()) { @@ -390,7 +409,7 @@ int cmCTestBuildAndTestHandler::ProcessCommandLineArguments( if(currentArg.find("--build-target",0) == 0 && idx < allArgs.size() - 1) { idx++; - m_BuildTarget = allArgs[idx]; + m_BuildTargets.push_back(allArgs[idx]); } if(currentArg.find("--build-nocmake",0) == 0) { diff --git a/Source/CTest/cmCTestBuildAndTestHandler.h b/Source/CTest/cmCTestBuildAndTestHandler.h index 3d1f30b..d2ec82f 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.h +++ b/Source/CTest/cmCTestBuildAndTestHandler.h @@ -73,7 +73,7 @@ protected: std::string m_BuildRunDir; std::string m_ExecutableDirectory; std::vector<std::string> m_TestCommandArgs; - std::string m_BuildTarget; + std::vector<std::string> m_BuildTargets; bool m_BuildNoCMake; }; diff --git a/Tests/SimpleInstall/CMakeLists.txt b/Tests/SimpleInstall/CMakeLists.txt index c712978..b4787c8 100644 --- a/Tests/SimpleInstall/CMakeLists.txt +++ b/Tests/SimpleInstall/CMakeLists.txt @@ -120,6 +120,14 @@ ELSE(CMAKE_CONFIGURATION_TYPES) SET(SI_CONFIG) ENDIF(CMAKE_CONFIGURATION_TYPES) +# Dummy test of CPack +SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Test of packaging with cpack") +SET(CPACK_PACKAGE_VENDOR "Kitware") +SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/foo.h") + +SET(CPACK_PACKAGE_EXECUTABLES "SimpleInstall" "Simple Install") +INCLUDE(CPack) + ADD_CUSTOM_COMMAND( TARGET ${install_target} POST_BUILD @@ -133,5 +141,6 @@ ADD_CUSTOM_COMMAND( --build-makeprogram ${CMAKE_MAKE_PROGRAM} --build-noclean --build-target install + --build-target package COMMENT "Install Project" ) diff --git a/Tests/SimpleInstallS2/CMakeLists.txt b/Tests/SimpleInstallS2/CMakeLists.txt index c712978..b4787c8 100644 --- a/Tests/SimpleInstallS2/CMakeLists.txt +++ b/Tests/SimpleInstallS2/CMakeLists.txt @@ -120,6 +120,14 @@ ELSE(CMAKE_CONFIGURATION_TYPES) SET(SI_CONFIG) ENDIF(CMAKE_CONFIGURATION_TYPES) +# Dummy test of CPack +SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Test of packaging with cpack") +SET(CPACK_PACKAGE_VENDOR "Kitware") +SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/foo.h") + +SET(CPACK_PACKAGE_EXECUTABLES "SimpleInstall" "Simple Install") +INCLUDE(CPack) + ADD_CUSTOM_COMMAND( TARGET ${install_target} POST_BUILD @@ -133,5 +141,6 @@ ADD_CUSTOM_COMMAND( --build-makeprogram ${CMAKE_MAKE_PROGRAM} --build-noclean --build-target install + --build-target package COMMENT "Install Project" ) |