Merge topic 'lang-enable-order-issue-12929'

7495845 Fix CXX/Fortran MODULE flags when enabled before C (#12929)
This commit is contained in:
David Cole 2012-02-07 15:35:11 -05:00 committed by CMake Topic Stage
commit 986981ea03
6 changed files with 32 additions and 6 deletions

View File

@ -93,12 +93,6 @@ IF(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX)
ENDIF()
# for most systems a module is the same as a shared library
# so unless the variable CMAKE_MODULE_EXISTS is set just
# copy the values from the LIBRARY variables
IF(NOT CMAKE_MODULE_EXISTS)
SET(CMAKE_SHARED_MODULE_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS})
ENDIF(NOT CMAKE_MODULE_EXISTS)
# Create a set of shared library variable specific to C++
# For 90% of the systems, these are the same flags as the C versions
# so if these are not set just copy the flags from the c version
@ -158,6 +152,14 @@ IF(NOT CMAKE_INCLUDE_FLAG_SEP_CXX)
SET(CMAKE_INCLUDE_FLAG_SEP_CXX ${CMAKE_INCLUDE_FLAG_SEP_C})
ENDIF(NOT CMAKE_INCLUDE_FLAG_SEP_CXX)
# for most systems a module is the same as a shared library
# so unless the variable CMAKE_MODULE_EXISTS is set just
# copy the values from the LIBRARY variables
IF(NOT CMAKE_MODULE_EXISTS)
SET(CMAKE_SHARED_MODULE_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS})
SET(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS})
ENDIF(NOT CMAKE_MODULE_EXISTS)
# repeat for modules
IF(NOT CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS)
SET(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS})

View File

@ -109,6 +109,14 @@ IF(NOT DEFINED CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG)
SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_SONAME_C_FLAG})
ENDIF()
# for most systems a module is the same as a shared library
# so unless the variable CMAKE_MODULE_EXISTS is set just
# copy the values from the LIBRARY variables
IF(NOT CMAKE_MODULE_EXISTS)
SET(CMAKE_SHARED_MODULE_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_Fortran_FLAGS})
SET(CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS})
ENDIF(NOT CMAKE_MODULE_EXISTS)
# repeat for modules
IF(NOT DEFINED CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS)
SET(CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS})

View File

@ -19,3 +19,5 @@ if("${LANG}" STREQUAL "C")
else("${LANG}" STREQUAL "C")
message(FATAL_ERROR "Bad language for file conly.c")
endif("${LANG}" STREQUAL "C")
add_library(testCModule MODULE testCModule.c)

View File

@ -0,0 +1,6 @@
#ifdef _WIN32
# define TEST_EXPORT __declspec(dllexport)
#else
# define TEST_EXPORT
#endif
TEST_EXPORT int testCModule(void) { return 0; }

View File

@ -9,3 +9,5 @@ add_library(testcxx1.my STATIC libcxx1.cxx ${EXTRA_SRCS})
add_library(testcxx2 SHARED libcxx2.cxx)
add_executable (CxxOnly cxxonly.cxx)
target_link_libraries(CxxOnly testcxx1.my testcxx2)
add_library(testCxxModule MODULE testCxxModule.cxx)

View File

@ -0,0 +1,6 @@
#ifdef _WIN32
# define TEST_EXPORT __declspec(dllexport)
#else
# define TEST_EXPORT
#endif
TEST_EXPORT int testCxxModule(void) { return 0; }