diff options
-rw-r--r-- | Source/WXDialog/CMakeLists.txt | 7 | ||||
-rw-r--r-- | Source/cmaketest.cxx | 33 |
2 files changed, 31 insertions, 9 deletions
diff --git a/Source/WXDialog/CMakeLists.txt b/Source/WXDialog/CMakeLists.txt index 2914681..8633452 100644 --- a/Source/WXDialog/CMakeLists.txt +++ b/Source/WXDialog/CMakeLists.txt @@ -1,6 +1,7 @@ INCLUDE (${CMAKE_ROOT}/Modules/FindwxWindows.cmake) -IF ( CMAKE_WX_CAN_COMPILE ) +IF ( WXWINDOWS_FOUND ) + INCLUDE(${CMAKE_ROOT}/Modules/Use_wxWindows.cmake) SET( WX_SRCS cmWXCacheProperty.cxx @@ -65,8 +66,8 @@ IF ( CMAKE_WX_CAN_COMPILE ) -Q -A:ON -B:${CMake_BINARY_DIR}/Tests/Simple -H:${CMake_SOURCE_DIR}/Tests/Simple) ENDIF(BUILD_TESTING) -ELSE ( CMAKE_WX_CAN_COMPILE ) +ELSE ( WXWINDOWS_FOUND ) MESSAGE("Cannot find wxWindows libraries and/or header files") -ENDIF ( CMAKE_WX_CAN_COMPILE ) +ENDIF ( WXWINDOWS_FOUND ) diff --git a/Source/cmaketest.cxx b/Source/cmaketest.cxx index aca0f93..152d601 100644 --- a/Source/cmaketest.cxx +++ b/Source/cmaketest.cxx @@ -170,6 +170,11 @@ int do_cmaketest (int argc, char **argv) { std::cerr << "Error: cmaketest does not have a valid MAKEPROGRAM\n"; } + + // Return value for run command; + int retVal = 0; + int ret = 0; + makeCommand = cmSystemTools::ConvertToOutputPath(makeCommand.c_str()); std::string lowerCaseCommand = cmSystemTools::LowerCase(makeCommand); // if msdev is the make program then do the following @@ -212,12 +217,14 @@ int do_cmaketest (int argc, char **argv) std::string cleanCommand = makeCommand; cleanCommand += " clean"; std::cout << "Running make clean command: " << cleanCommand.c_str() << " ...\n"; - if (!cmSystemTools::RunCommand(cleanCommand.c_str(), output)) + retVal = 0; + if (!cmSystemTools::RunCommand(cleanCommand.c_str(), output, retVal) || retVal) { std::cerr << "Error: " << cleanCommand.c_str() << " execution failed\n"; std::cerr << output.c_str() << "\n"; // return to the original directory cmSystemTools::ChangeDirectory(cwd.c_str()); + std::cerr << "Return value: " << retVal << std::endl; return 1; } @@ -225,7 +232,8 @@ int do_cmaketest (int argc, char **argv) } std::cout << "Running make command: " << makeCommand.c_str() << " ...\n"; - if (!cmSystemTools::RunCommand(makeCommand.c_str(), output)) + retVal = 0; + if (!cmSystemTools::RunCommand(makeCommand.c_str(), output, retVal)) { std::cerr << "Error: " << makeCommand.c_str() << " execution failed\n"; std::cerr << output.c_str() << "\n"; @@ -233,6 +241,14 @@ int do_cmaketest (int argc, char **argv) cmSystemTools::ChangeDirectory(cwd.c_str()); return 1; } + if ( retVal ) + { + cmSystemTools::Error("Building of project failed\n"); + std::cerr << output.c_str() << "\n"; + // return to the original directory + cmSystemTools::ChangeDirectory(cwd.c_str()); + ret = 1; + } // now run the compiled test if we can find it // See if the executable exists as written. @@ -293,21 +309,26 @@ int do_cmaketest (int argc, char **argv) fullPath += *p; } std::cout << "Running test executable: " << fullPath.c_str() << "\n"; - int ret = 0; - if (!cmSystemTools::RunCommand(fullPath.c_str(), output, ret, 0, true)) + retVal = 0; + if (!cmSystemTools::RunCommand(fullPath.c_str(), output, retVal, 0, true)) { std::cerr << "Error: " << fullPath.c_str() << " execution failed\n"; // return to the original directory cmSystemTools::ChangeDirectory(cwd.c_str()); return 1; - } + } std::cout << output << "\n"; // return to the original directory cmSystemTools::ChangeDirectory(cwd.c_str()); - if(ret) + if(retVal) { cmSystemTools::Error("test executable ", fullPath.c_str(), "returned a non-zero value"); + ret = 1; + } + if ( ret ) + { + cmSystemTools::Error("Test failed"); } return ret; } |