diff options
-rw-r--r-- | Tests/ExportImport/CMakeLists.txt | 35 | ||||
-rw-r--r-- | Tests/ExportImport/Export/CMakeLists.txt | 9 | ||||
-rw-r--r-- | Tests/ExportImport/Export/testLib6.c | 5 | ||||
-rw-r--r-- | Tests/ExportImport/Export/testLib6.cxx | 6 | ||||
-rw-r--r-- | Tests/ExportImport/Import/A/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/ExportImport/Import/A/imp_testExe1.c | 3 | ||||
-rw-r--r-- | Tests/ExportImport/Import/CMakeLists.txt | 4 |
7 files changed, 42 insertions, 22 deletions
diff --git a/Tests/ExportImport/CMakeLists.txt b/Tests/ExportImport/CMakeLists.txt index 3b54e9d..af28fd9 100644 --- a/Tests/ExportImport/CMakeLists.txt +++ b/Tests/ExportImport/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required (VERSION 2.6) -project(ExportImport C) +cmake_minimum_required (VERSION 2.7.20090711) +project(ExportImport C CXX) # Wipe out the install tree to make sure the exporter works. add_custom_command( @@ -22,6 +22,21 @@ else(CMAKE_CONFIGURATION_TYPES) endif(CMAKE_BUILD_TYPE) endif(CMAKE_CONFIGURATION_TYPES) +set(SAME_COMPILER + -DCMAKE_C_COMPILER:STRING=${CMAKE_C_COMPILER} + -DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS} + -DCMAKE_C_FLAGS_DEBUG:STRING=${CMAKE_C_FLAGS_DEBUG} + -DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE} + -DCMAKE_C_FLAGS_MINSIZEREL:STRING=${CMAKE_C_FLAGS_MINSIZEREL} + -DCMAKE_C_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_C_FLAGS_RELWITHDEBINFO} + -DCMAKE_CXX_COMPILER:STRING=${CMAKE_CXX_COMPILER} + -DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS} + -DCMAKE_CXX_FLAGS_DEBUG:STRING=${CMAKE_CXX_FLAGS_DEBUG} + -DCMAKE_CXX_FLAGS_RELEASE:STRING=${CMAKE_CXX_FLAGS_RELEASE} + -DCMAKE_CXX_FLAGS_MINSIZEREL:STRING=${CMAKE_CXX_FLAGS_MINSIZEREL} + -DCMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_CXX_FLAGS_RELWITHDEBINFO} + ) + # Build and install the exporter. add_custom_command( OUTPUT ${ExportImport_BINARY_DIR}/ExportProject @@ -34,13 +49,7 @@ add_custom_command( --build-target install --build-generator ${CMAKE_GENERATOR} --build-makeprogram ${CMAKE_MAKE_PROGRAM} - --build-options - -DCMAKE_C_COMPILER:STRING=${CMAKE_C_COMPILER} - -DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS} - -DCMAKE_C_FLAGS_DEBUG:STRING=${CMAKE_C_FLAGS_DEBUG} - -DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE} - -DCMAKE_C_FLAGS_MINSIZEREL:STRING=${CMAKE_C_FLAGS_MINSIZEREL} - -DCMAKE_C_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_C_FLAGS_RELWITHDEBINFO} + --build-options ${SAME_COMPILER} -DCMAKE_INSTALL_PREFIX:STRING=${ExportImport_BINARY_DIR}/Root -DCMAKE_SKIP_RPATH:BOOL=ON ) @@ -62,13 +71,7 @@ add_custom_command( --build-project Import --build-generator ${CMAKE_GENERATOR} --build-makeprogram ${CMAKE_MAKE_PROGRAM} - --build-options - -DCMAKE_C_COMPILER:STRING=${CMAKE_C_COMPILER} - -DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS} - -DCMAKE_C_FLAGS_DEBUG:STRING=${CMAKE_C_FLAGS_DEBUG} - -DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE} - -DCMAKE_C_FLAGS_MINSIZEREL:STRING=${CMAKE_C_FLAGS_MINSIZEREL} - -DCMAKE_C_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_C_FLAGS_RELWITHDEBINFO} + --build-options ${SAME_COMPILER} -DCMAKE_INSTALL_PREFIX:STRING=${ExportImport_BINARY_DIR}/Root -DCMAKE_SKIP_RPATH:BOOL=ON ) diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index 4de3f64..1588b0c 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required (VERSION 2.6) -project(Export C) +cmake_minimum_required (VERSION 2.7.20090711) +project(Export C CXX) # Pretend that RelWithDebInfo should link to debug libraries to test # the DEBUG_CONFIGURATIONS property. @@ -45,6 +45,8 @@ set_property(TARGET testLib4 PROPERTY FRAMEWORK 1) add_library(testLib5 SHARED testLib5.c) +add_library(testLib6 STATIC testLib6.cxx testLib6.c) + # Work-around: Visual Studio 6 does not support per-target object files. set(VS6) if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 6") @@ -76,6 +78,7 @@ install( TARGETS testExe1 testLib1 testLib2 testExe2 testLib3 testLib4 testExe3 testExe2lib testLib4lib testLib4libdbg testLib4libopt + testLib6 EXPORT exp RUNTIME DESTINATION bin LIBRARY DESTINATION lib NAMELINK_SKIP @@ -111,7 +114,7 @@ export(TARGETS testExe1 testLib1 testLib2 testLib3 NAMESPACE bld_ FILE ExportBuildTree.cmake ) -export(TARGETS testExe2 testLib4 testLib5 testExe3 testExe2lib +export(TARGETS testExe2 testLib4 testLib5 testLib6 testExe3 testExe2lib testLib4lib testLib4libdbg testLib4libopt NAMESPACE bld_ APPEND FILE ExportBuildTree.cmake diff --git a/Tests/ExportImport/Export/testLib6.c b/Tests/ExportImport/Export/testLib6.c new file mode 100644 index 0000000..493ca07 --- /dev/null +++ b/Tests/ExportImport/Export/testLib6.c @@ -0,0 +1,5 @@ +extern int testLib6cxx(void); +int testLib6(void) +{ + return testLib6cxx(); +} diff --git a/Tests/ExportImport/Export/testLib6.cxx b/Tests/ExportImport/Export/testLib6.cxx new file mode 100644 index 0000000..338e639 --- /dev/null +++ b/Tests/ExportImport/Export/testLib6.cxx @@ -0,0 +1,6 @@ +extern "C" int testLib6cxx(void) +{ + // Reference C++ standard library symbols. + delete new int; + return 0; +} diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt index e874cdb..f6536df 100644 --- a/Tests/ExportImport/Import/A/CMakeLists.txt +++ b/Tests/ExportImport/Import/A/CMakeLists.txt @@ -28,6 +28,7 @@ target_link_libraries(imp_testExe1 exp_testLib3 exp_testLib4 exp_testLib5 + exp_testLib6 ) # Try building a plugin to an executable imported from the install tree. @@ -58,6 +59,7 @@ target_link_libraries(imp_testExe1b bld_testLib3 bld_testLib4 bld_testLib5 + bld_testLib6 ) # Try building a plugin to an executable imported from the build tree. diff --git a/Tests/ExportImport/Import/A/imp_testExe1.c b/Tests/ExportImport/Import/A/imp_testExe1.c index 6a6ba0f..b690d99 100644 --- a/Tests/ExportImport/Import/A/imp_testExe1.c +++ b/Tests/ExportImport/Import/A/imp_testExe1.c @@ -5,6 +5,7 @@ extern int testLib3(); extern int testLib4(); extern int testLib4lib(); extern int testLib5(); +extern int testLib6(); /* Switch a symbol between debug and optimized builds to make sure the proper library is found from the testLib4 link interface. */ @@ -18,6 +19,6 @@ extern testLib4libcfg(void); int main() { return (testLib2() + generated_by_testExe1() + testLib3() + testLib4() - + testLib5() + + testLib5() + testLib6() + generated_by_testExe3() + testLib4lib() + testLib4libcfg()); } diff --git a/Tests/ExportImport/Import/CMakeLists.txt b/Tests/ExportImport/Import/CMakeLists.txt index eb3a954..3fc78a2 100644 --- a/Tests/ExportImport/Import/CMakeLists.txt +++ b/Tests/ExportImport/Import/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required (VERSION 2.6) -project(Import C) +cmake_minimum_required (VERSION 2.7.20090711) +project(Import C CXX) # Import everything in a subdirectory. add_subdirectory(A) |