From b646183f441bcc3c9f3b094defbe71a3b56a60a3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 19 Oct 2006 14:45:41 -0400 Subject: ENH: Added explicit name for option to test CMakeLib. Added option to disable testing of CMakeLib if system utility libraries are used until linking made easier. --- Tests/Complex/CMakeLists.txt | 9 +++++++++ Tests/Complex/Executable/CMakeLists.txt | 8 ++++---- Tests/Complex/Executable/complex.cxx | 10 +++++----- Tests/Complex/cmTestConfigure.h.in | 3 ++- Tests/ComplexOneConfig/CMakeLists.txt | 9 +++++++++ Tests/ComplexOneConfig/Executable/CMakeLists.txt | 8 ++++---- Tests/ComplexOneConfig/Executable/complex.cxx | 10 +++++----- Tests/ComplexOneConfig/cmTestConfigure.h.in | 3 ++- Tests/ComplexRelativePaths/CMakeLists.txt | 9 +++++++++ Tests/ComplexRelativePaths/Executable/CMakeLists.txt | 8 ++++---- Tests/ComplexRelativePaths/Executable/complex.cxx | 10 +++++----- Tests/ComplexRelativePaths/cmTestConfigure.h.in | 3 ++- 12 files changed, 60 insertions(+), 30 deletions(-) diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt index fa3ee41..5a28e56 100644 --- a/Tests/Complex/CMakeLists.txt +++ b/Tests/Complex/CMakeLists.txt @@ -4,6 +4,15 @@ SET(CMAKE_BACKWARDS_COMPATIBILITY 1.4) PROJECT (Complex) +# Choose whether to test CMakeLib. +SET(COMPLEX_TEST_CMAKELIB 1) +IF(CMAKE_TEST_DIFFERENT_GENERATOR) + SET(COMPLEX_TEST_CMAKELIB 0) +ENDIF(CMAKE_TEST_DIFFERENT_GENERATOR) +IF(CMAKE_TEST_SYSTEM_LIBRARIES) + SET(COMPLEX_TEST_CMAKELIB 0) +ENDIF(CMAKE_TEST_SYSTEM_LIBRARIES) + # # Define a macro # diff --git a/Tests/Complex/Executable/CMakeLists.txt b/Tests/Complex/Executable/CMakeLists.txt index 28db54e..f61963a 100644 --- a/Tests/Complex/Executable/CMakeLists.txt +++ b/Tests/Complex/Executable/CMakeLists.txt @@ -6,14 +6,14 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTEST_CXX_FLAGS") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTEST_C_FLAGS") SET(CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS}") -IF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) +IF(COMPLEX_TEST_CMAKELIB) # Link to CMake lib LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Source) LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Source/kwsys) LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Utilities/cmexpat) LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Utilities/cmzlib) LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Utilities/cmtar) -ENDIF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) +ENDIF(COMPLEX_TEST_CMAKELIB) # Use LINK_LIBRARIES instead of TARGET_LINK_LIBRARIES to SET(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared;CMakeTestCLibraryShared) @@ -23,9 +23,9 @@ ADD_EXECUTABLE(A A.cxx A.hh A.h A.txt) ADD_EXECUTABLE(complex complex testcflags.c ) # Sub1/NameConflictTest.c Sub2/NameConflictTest.c) ADD_EXECUTABLE(complex.file complex.file.cxx) -IF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) +IF(COMPLEX_TEST_CMAKELIB) TARGET_LINK_LIBRARIES(complex CMakeLib cmsys cmexpat cmzlib cmtar) -ENDIF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) +ENDIF(COMPLEX_TEST_CMAKELIB) IF (UNIX) TARGET_LINK_LIBRARIES(complex ${CMAKE_DL_LIBS}) diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx index 273e8a2..89c7dbd 100644 --- a/Tests/Complex/Executable/complex.cxx +++ b/Tests/Complex/Executable/complex.cxx @@ -8,7 +8,7 @@ extern "C" { #include "testConly.h" } -#ifndef CMAKE_TEST_DIFFERENT_GENERATOR +#ifdef CMAKE_TEST_CMAKELIB #include "cmStandardIncludes.h" #include "cmSystemTools.h" #include "cmDynamicLoader.h" @@ -64,7 +64,7 @@ void cmPassed(const char* Message, const char* m2="") This is a problem. Looks like ADD_DEFINITIONS and REMOVE_DEFINITIONS does not work #endif -#ifndef CMAKE_TEST_DIFFERENT_GENERATOR +#ifdef CMAKE_TEST_CMAKELIB // Here is a stupid function that tries to use std::string methods // so that the dec cxx compiler will instantiate the stuff that // we are using from the CMakeLib library.... @@ -327,7 +327,7 @@ int main() #endif std::string exe = lib; -#ifndef CMAKE_TEST_DIFFERENT_GENERATOR +#ifdef CMAKE_TEST_CMAKELIB // Test a single character executable to test a: in makefiles exe += "A"; exe += cmSystemTools::GetExecutableExtension(); @@ -1059,7 +1059,7 @@ int main() } #endif -#ifndef CMAKE_TEST_DIFFERENT_GENERATOR +#ifdef CMAKE_TEST_CMAKELIB // ---------------------------------------------------------------------- // Some pre-build/pre-link/post-build custom-commands have been // attached to the lib (see Library/). @@ -1257,7 +1257,7 @@ int main() cmPassed("CMake SET CACHE FORCE"); #endif -#ifndef CMAKE_TEST_DIFFERENT_GENERATOR +#ifdef CMAKE_TEST_CMAKELIB // first run with shouldFail = true, this will // run with A B C as set by the CMakeList.txt file. if(!TestLibraryOrder(true)) diff --git a/Tests/Complex/cmTestConfigure.h.in b/Tests/Complex/cmTestConfigure.h.in index 0b1e181..8034203 100644 --- a/Tests/Complex/cmTestConfigure.h.in +++ b/Tests/Complex/cmTestConfigure.h.in @@ -4,7 +4,8 @@ #cmakedefine ONE_VAR_IS_DEFINED #cmakedefine ZERO_VAR -#cmakedefine CMAKE_TEST_DIFFERENT_GENERATOR +#cmakedefine COMPLEX_TEST_CMAKELIB + #define STRING_VAR "${STRING_VAR}" // Test FOREACH diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt index fa3ee41..5a28e56 100644 --- a/Tests/ComplexOneConfig/CMakeLists.txt +++ b/Tests/ComplexOneConfig/CMakeLists.txt @@ -4,6 +4,15 @@ SET(CMAKE_BACKWARDS_COMPATIBILITY 1.4) PROJECT (Complex) +# Choose whether to test CMakeLib. +SET(COMPLEX_TEST_CMAKELIB 1) +IF(CMAKE_TEST_DIFFERENT_GENERATOR) + SET(COMPLEX_TEST_CMAKELIB 0) +ENDIF(CMAKE_TEST_DIFFERENT_GENERATOR) +IF(CMAKE_TEST_SYSTEM_LIBRARIES) + SET(COMPLEX_TEST_CMAKELIB 0) +ENDIF(CMAKE_TEST_SYSTEM_LIBRARIES) + # # Define a macro # diff --git a/Tests/ComplexOneConfig/Executable/CMakeLists.txt b/Tests/ComplexOneConfig/Executable/CMakeLists.txt index 28db54e..f61963a 100644 --- a/Tests/ComplexOneConfig/Executable/CMakeLists.txt +++ b/Tests/ComplexOneConfig/Executable/CMakeLists.txt @@ -6,14 +6,14 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTEST_CXX_FLAGS") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTEST_C_FLAGS") SET(CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS}") -IF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) +IF(COMPLEX_TEST_CMAKELIB) # Link to CMake lib LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Source) LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Source/kwsys) LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Utilities/cmexpat) LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Utilities/cmzlib) LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Utilities/cmtar) -ENDIF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) +ENDIF(COMPLEX_TEST_CMAKELIB) # Use LINK_LIBRARIES instead of TARGET_LINK_LIBRARIES to SET(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared;CMakeTestCLibraryShared) @@ -23,9 +23,9 @@ ADD_EXECUTABLE(A A.cxx A.hh A.h A.txt) ADD_EXECUTABLE(complex complex testcflags.c ) # Sub1/NameConflictTest.c Sub2/NameConflictTest.c) ADD_EXECUTABLE(complex.file complex.file.cxx) -IF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) +IF(COMPLEX_TEST_CMAKELIB) TARGET_LINK_LIBRARIES(complex CMakeLib cmsys cmexpat cmzlib cmtar) -ENDIF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) +ENDIF(COMPLEX_TEST_CMAKELIB) IF (UNIX) TARGET_LINK_LIBRARIES(complex ${CMAKE_DL_LIBS}) diff --git a/Tests/ComplexOneConfig/Executable/complex.cxx b/Tests/ComplexOneConfig/Executable/complex.cxx index 273e8a2..89c7dbd 100644 --- a/Tests/ComplexOneConfig/Executable/complex.cxx +++ b/Tests/ComplexOneConfig/Executable/complex.cxx @@ -8,7 +8,7 @@ extern "C" { #include "testConly.h" } -#ifndef CMAKE_TEST_DIFFERENT_GENERATOR +#ifdef CMAKE_TEST_CMAKELIB #include "cmStandardIncludes.h" #include "cmSystemTools.h" #include "cmDynamicLoader.h" @@ -64,7 +64,7 @@ void cmPassed(const char* Message, const char* m2="") This is a problem. Looks like ADD_DEFINITIONS and REMOVE_DEFINITIONS does not work #endif -#ifndef CMAKE_TEST_DIFFERENT_GENERATOR +#ifdef CMAKE_TEST_CMAKELIB // Here is a stupid function that tries to use std::string methods // so that the dec cxx compiler will instantiate the stuff that // we are using from the CMakeLib library.... @@ -327,7 +327,7 @@ int main() #endif std::string exe = lib; -#ifndef CMAKE_TEST_DIFFERENT_GENERATOR +#ifdef CMAKE_TEST_CMAKELIB // Test a single character executable to test a: in makefiles exe += "A"; exe += cmSystemTools::GetExecutableExtension(); @@ -1059,7 +1059,7 @@ int main() } #endif -#ifndef CMAKE_TEST_DIFFERENT_GENERATOR +#ifdef CMAKE_TEST_CMAKELIB // ---------------------------------------------------------------------- // Some pre-build/pre-link/post-build custom-commands have been // attached to the lib (see Library/). @@ -1257,7 +1257,7 @@ int main() cmPassed("CMake SET CACHE FORCE"); #endif -#ifndef CMAKE_TEST_DIFFERENT_GENERATOR +#ifdef CMAKE_TEST_CMAKELIB // first run with shouldFail = true, this will // run with A B C as set by the CMakeList.txt file. if(!TestLibraryOrder(true)) diff --git a/Tests/ComplexOneConfig/cmTestConfigure.h.in b/Tests/ComplexOneConfig/cmTestConfigure.h.in index 0b1e181..8034203 100644 --- a/Tests/ComplexOneConfig/cmTestConfigure.h.in +++ b/Tests/ComplexOneConfig/cmTestConfigure.h.in @@ -4,7 +4,8 @@ #cmakedefine ONE_VAR_IS_DEFINED #cmakedefine ZERO_VAR -#cmakedefine CMAKE_TEST_DIFFERENT_GENERATOR +#cmakedefine COMPLEX_TEST_CMAKELIB + #define STRING_VAR "${STRING_VAR}" // Test FOREACH diff --git a/Tests/ComplexRelativePaths/CMakeLists.txt b/Tests/ComplexRelativePaths/CMakeLists.txt index fa3ee41..5a28e56 100644 --- a/Tests/ComplexRelativePaths/CMakeLists.txt +++ b/Tests/ComplexRelativePaths/CMakeLists.txt @@ -4,6 +4,15 @@ SET(CMAKE_BACKWARDS_COMPATIBILITY 1.4) PROJECT (Complex) +# Choose whether to test CMakeLib. +SET(COMPLEX_TEST_CMAKELIB 1) +IF(CMAKE_TEST_DIFFERENT_GENERATOR) + SET(COMPLEX_TEST_CMAKELIB 0) +ENDIF(CMAKE_TEST_DIFFERENT_GENERATOR) +IF(CMAKE_TEST_SYSTEM_LIBRARIES) + SET(COMPLEX_TEST_CMAKELIB 0) +ENDIF(CMAKE_TEST_SYSTEM_LIBRARIES) + # # Define a macro # diff --git a/Tests/ComplexRelativePaths/Executable/CMakeLists.txt b/Tests/ComplexRelativePaths/Executable/CMakeLists.txt index 28db54e..f61963a 100644 --- a/Tests/ComplexRelativePaths/Executable/CMakeLists.txt +++ b/Tests/ComplexRelativePaths/Executable/CMakeLists.txt @@ -6,14 +6,14 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTEST_CXX_FLAGS") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTEST_C_FLAGS") SET(CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS}") -IF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) +IF(COMPLEX_TEST_CMAKELIB) # Link to CMake lib LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Source) LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Source/kwsys) LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Utilities/cmexpat) LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Utilities/cmzlib) LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Utilities/cmtar) -ENDIF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) +ENDIF(COMPLEX_TEST_CMAKELIB) # Use LINK_LIBRARIES instead of TARGET_LINK_LIBRARIES to SET(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared;CMakeTestCLibraryShared) @@ -23,9 +23,9 @@ ADD_EXECUTABLE(A A.cxx A.hh A.h A.txt) ADD_EXECUTABLE(complex complex testcflags.c ) # Sub1/NameConflictTest.c Sub2/NameConflictTest.c) ADD_EXECUTABLE(complex.file complex.file.cxx) -IF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) +IF(COMPLEX_TEST_CMAKELIB) TARGET_LINK_LIBRARIES(complex CMakeLib cmsys cmexpat cmzlib cmtar) -ENDIF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) +ENDIF(COMPLEX_TEST_CMAKELIB) IF (UNIX) TARGET_LINK_LIBRARIES(complex ${CMAKE_DL_LIBS}) diff --git a/Tests/ComplexRelativePaths/Executable/complex.cxx b/Tests/ComplexRelativePaths/Executable/complex.cxx index 273e8a2..89c7dbd 100644 --- a/Tests/ComplexRelativePaths/Executable/complex.cxx +++ b/Tests/ComplexRelativePaths/Executable/complex.cxx @@ -8,7 +8,7 @@ extern "C" { #include "testConly.h" } -#ifndef CMAKE_TEST_DIFFERENT_GENERATOR +#ifdef CMAKE_TEST_CMAKELIB #include "cmStandardIncludes.h" #include "cmSystemTools.h" #include "cmDynamicLoader.h" @@ -64,7 +64,7 @@ void cmPassed(const char* Message, const char* m2="") This is a problem. Looks like ADD_DEFINITIONS and REMOVE_DEFINITIONS does not work #endif -#ifndef CMAKE_TEST_DIFFERENT_GENERATOR +#ifdef CMAKE_TEST_CMAKELIB // Here is a stupid function that tries to use std::string methods // so that the dec cxx compiler will instantiate the stuff that // we are using from the CMakeLib library.... @@ -327,7 +327,7 @@ int main() #endif std::string exe = lib; -#ifndef CMAKE_TEST_DIFFERENT_GENERATOR +#ifdef CMAKE_TEST_CMAKELIB // Test a single character executable to test a: in makefiles exe += "A"; exe += cmSystemTools::GetExecutableExtension(); @@ -1059,7 +1059,7 @@ int main() } #endif -#ifndef CMAKE_TEST_DIFFERENT_GENERATOR +#ifdef CMAKE_TEST_CMAKELIB // ---------------------------------------------------------------------- // Some pre-build/pre-link/post-build custom-commands have been // attached to the lib (see Library/). @@ -1257,7 +1257,7 @@ int main() cmPassed("CMake SET CACHE FORCE"); #endif -#ifndef CMAKE_TEST_DIFFERENT_GENERATOR +#ifdef CMAKE_TEST_CMAKELIB // first run with shouldFail = true, this will // run with A B C as set by the CMakeList.txt file. if(!TestLibraryOrder(true)) diff --git a/Tests/ComplexRelativePaths/cmTestConfigure.h.in b/Tests/ComplexRelativePaths/cmTestConfigure.h.in index 0b1e181..8034203 100644 --- a/Tests/ComplexRelativePaths/cmTestConfigure.h.in +++ b/Tests/ComplexRelativePaths/cmTestConfigure.h.in @@ -4,7 +4,8 @@ #cmakedefine ONE_VAR_IS_DEFINED #cmakedefine ZERO_VAR -#cmakedefine CMAKE_TEST_DIFFERENT_GENERATOR +#cmakedefine COMPLEX_TEST_CMAKELIB + #define STRING_VAR "${STRING_VAR}" // Test FOREACH -- cgit v0.12