From 45aec045089bba7b66ce0920f3baa4fa6eb7a898 Mon Sep 17 00:00:00 2001 From: Alexander Neundorf Date: Fri, 7 Nov 2008 15:56:54 -0500 Subject: [PATCH] ENH: load CMakeDetermineSystem and CMakeSystemSpecificInformation when executing a ctest script so the search paths are fully set up and variables like CMAKE_SYSTEM are available. This is useful e.g. for new-style ctest scripting. (these files are also loaded on startup by cpack, so now they behave similar). Hmmm, maybe they should be also loaded by cmake -P ? Alex --- Source/CTest/cmCTestScriptHandler.cxx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 40926adbd..67b171b5a 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -380,6 +380,26 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) f->CTestScriptHandler = this; this->Makefile->AddFunctionBlocker(f); + /* Execute CMakeDetermineSystem and CMakeSystemSpecificInformation, so + that variables like CMAKE_SYSTEM and also the search paths for libraries, + header and executables are set correctly and can be used. Makes new-style + ctest scripting easier. */ + std::string systemFile = + this->Makefile->GetModulesFile("CMakeDetermineSystem.cmake"); + if (!this->Makefile->ReadListFile(0, systemFile.c_str()) || + cmSystemTools::GetErrorOccuredFlag()) + { + return 2; + } + + systemFile = + this->Makefile->GetModulesFile("CMakeSystemSpecificInformation.cmake"); + if (!this->Makefile->ReadListFile(0, systemFile.c_str()) || + cmSystemTools::GetErrorOccuredFlag()) + { + return 2; + } + // finally read in the script if (!this->Makefile->ReadListFile(0, script.c_str()) || cmSystemTools::GetErrorOccuredFlag())