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())