From 9338803697da3623a61631809898af2334e38c48 Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Wed, 16 May 2007 07:55:00 -0400 Subject: BUG: fix test for hp move to c++ to avoid ansi issues and produce a message if the compile fails, (really checked in by Bill H.) --- Tests/BuildDepends/CMakeLists.txt | 11 +++++++++-- Tests/BuildDepends/Project/bar.c | 11 ----------- Tests/BuildDepends/Project/bar.cxx | 11 +++++++++++ 3 files changed, 20 insertions(+), 13 deletions(-) delete mode 100644 Tests/BuildDepends/Project/bar.c create mode 100644 Tests/BuildDepends/Project/bar.cxx diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt index ed2f10c..80793bc 100644 --- a/Tests/BuildDepends/CMakeLists.txt +++ b/Tests/BuildDepends/CMakeLists.txt @@ -6,13 +6,17 @@ # and source files for the test project. project(BuildDepends) make_directory(${BuildDepends_BINARY_DIR}/Project) -write_file(${BuildDepends_BINARY_DIR}/Project/foo.c +write_file(${BuildDepends_BINARY_DIR}/Project/foo.cxx "const char* foo() { return \"foo\";}" ) try_compile(RESULT ${BuildDepends_BINARY_DIR}/Project ${BuildDepends_SOURCE_DIR}/Project testRebuild OUTPUT_VARIABLE OUTPUT) +if(NOT RESULT) + message(SEND_ERROR "Could not build test project: ${OUTPUT}") +endif(NOT RESULT) + set(bar ${BuildDepends_BINARY_DIR}/Project/bar${CMAKE_EXECUTABLE_SUFFIX}) message("${BuildDepends_BINARY_DIR}/Project/Debug/bar${CMAKE_EXECUTABLE_SUFFIX}") if(EXISTS @@ -32,7 +36,7 @@ else("${out}" STREQUAL "foo ") message(SEND_ERROR "Program did not rebuild with changed file: ${out}") endif("${out}" STREQUAL "foo ") -write_file(${BuildDepends_BINARY_DIR}/Project/foo.c +write_file(${BuildDepends_BINARY_DIR}/Project/foo.cxx "const char* foo() { return \"foo changed\";}" ) try_compile(RESULT ${BuildDepends_BINARY_DIR}/Project @@ -40,6 +44,9 @@ try_compile(RESULT testRebuild OUTPUT_VARIABLE OUTPUT) +if(NOT RESULT) + message(SEND_ERROR "Could not build test project: ${OUTPUT}") +endif(NOT RESULT) if(EXISTS "${BuildDepends_BINARY_DIR}/Project/Debug/bar${CMAKE_EXECUTABLE_SUFFIX}" ) message("found debug") diff --git a/Tests/BuildDepends/Project/bar.c b/Tests/BuildDepends/Project/bar.c deleted file mode 100644 index 4764af5..0000000 --- a/Tests/BuildDepends/Project/bar.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "stdio.h" - -const char* foo(); -int main() -{ - int i; - printf("%s\n", foo()); - fflush(stdout); - for(;;); - return 0; -} diff --git a/Tests/BuildDepends/Project/bar.cxx b/Tests/BuildDepends/Project/bar.cxx new file mode 100644 index 0000000..4764af5 --- /dev/null +++ b/Tests/BuildDepends/Project/bar.cxx @@ -0,0 +1,11 @@ +#include "stdio.h" + +const char* foo(); +int main() +{ + int i; + printf("%s\n", foo()); + fflush(stdout); + for(;;); + return 0; +} -- cgit v0.12