ENH: check for compile flags and add back c flag to unix generator

This commit is contained in:
Bill Hoffman 2002-04-09 12:02:48 -04:00
parent b3cb8ae4bd
commit d6da8ce630
12 changed files with 36 additions and 6 deletions

View File

@ -1,6 +1,7 @@
#
# Create exe.
#
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTEST_CXX_FLAGS")
SET_SOURCE_FILES_PROPERTIES(complex
COMPILE_FLAGS "-DFILE_HAS_EXTRA_COMPILE_FLAGS")
ADD_EXECUTABLE(complex complex)

View File

@ -132,7 +132,10 @@ int main()
{
cmPassed("Call to file2 function returned 1.");
}
#ifndef TEST_CXX_FLAGS
cmFailed("CMake CMAKE_CXX_FLAGS is not being passed to the compiler!");
#else
cmPassed("CMake CMAKE_CXX_FLAGS is being passed to the compiler.");
// ----------------------------------------------------------------------
// Test ADD_DEFINITIONS

View File

@ -25,7 +25,7 @@ ADD_LIBRARY(CMakeTestLibrary LibrarySources)
#
SOURCE_FILES(SharedLibrarySources sharedFile)
ADD_LIBRARY(CMakeTestLibraryShared SHARED SharedLibrarySources)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTEST_C_FLAGS")
ADD_LIBRARY(CMakeTestCLibraryShared SHARED testConly.c)
#

View File

@ -2,5 +2,11 @@
int CsharedFunction()
{
#ifndef TEST_C_FLAGS
printf("TEST_C_FLAGS failed\n");
return 0;
#else
printf("Passed: TEST_C_FLAGS passed\n");
#endif
return 1;
}

View File

@ -1,6 +1,7 @@
#
# Create exe.
#
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTEST_CXX_FLAGS")
SET_SOURCE_FILES_PROPERTIES(complex
COMPILE_FLAGS "-DFILE_HAS_EXTRA_COMPILE_FLAGS")
ADD_EXECUTABLE(complex complex)

View File

@ -132,7 +132,10 @@ int main()
{
cmPassed("Call to file2 function returned 1.");
}
#ifndef TEST_CXX_FLAGS
cmFailed("CMake CMAKE_CXX_FLAGS is not being passed to the compiler!");
#else
cmPassed("CMake CMAKE_CXX_FLAGS is being passed to the compiler.");
// ----------------------------------------------------------------------
// Test ADD_DEFINITIONS

View File

@ -25,7 +25,7 @@ ADD_LIBRARY(CMakeTestLibrary LibrarySources)
#
SOURCE_FILES(SharedLibrarySources sharedFile)
ADD_LIBRARY(CMakeTestLibraryShared SHARED SharedLibrarySources)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTEST_C_FLAGS")
ADD_LIBRARY(CMakeTestCLibraryShared SHARED testConly.c)
#

View File

@ -2,5 +2,11 @@
int CsharedFunction()
{
#ifndef TEST_C_FLAGS
printf("TEST_C_FLAGS failed\n");
return 0;
#else
printf("Passed: TEST_C_FLAGS passed\n");
#endif
return 1;
}

View File

@ -1,6 +1,7 @@
#
# Create exe.
#
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTEST_CXX_FLAGS")
SET_SOURCE_FILES_PROPERTIES(complex
COMPILE_FLAGS "-DFILE_HAS_EXTRA_COMPILE_FLAGS")
ADD_EXECUTABLE(complex complex)

View File

@ -132,7 +132,10 @@ int main()
{
cmPassed("Call to file2 function returned 1.");
}
#ifndef TEST_CXX_FLAGS
cmFailed("CMake CMAKE_CXX_FLAGS is not being passed to the compiler!");
#else
cmPassed("CMake CMAKE_CXX_FLAGS is being passed to the compiler.");
// ----------------------------------------------------------------------
// Test ADD_DEFINITIONS

View File

@ -25,7 +25,7 @@ ADD_LIBRARY(CMakeTestLibrary LibrarySources)
#
SOURCE_FILES(SharedLibrarySources sharedFile)
ADD_LIBRARY(CMakeTestLibraryShared SHARED SharedLibrarySources)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTEST_C_FLAGS")
ADD_LIBRARY(CMakeTestCLibraryShared SHARED testConly.c)
#

View File

@ -2,5 +2,11 @@
int CsharedFunction()
{
#ifndef TEST_C_FLAGS
printf("TEST_C_FLAGS failed\n");
return 0;
#else
printf("Passed: TEST_C_FLAGS passed\n");
#endif
return 1;
}