Skip to content

Commit

Permalink
Add release flags to fortran name mangling check (TriBITS #23)
Browse files Browse the repository at this point in the history
There is an issue with the config_tests/FortranMangling.cmake.  The issues
stems from Windows variety of system libraries.  One can use /MD[d] /MT[d]
/LD[d] for linking their different libraries MSVCRT.lib, MSVCRTD.lib,
LIBCMT.lib, LIBCMTD.lib.  CMake typically defaults to /MD for release and /MDd
for debug.  If one needs a static build overriding all compiler flags with
/MT[d] is necessary.  The FortranMangling.cmake doesn't pass the build type
compiler flags through which usually results in duplicate defined symbols,
because C/C++ will link against LIBCMT and Fortran will link agains MSVCRT.
This patch resolves the issue.
  • Loading branch information
Jordan P. Lefebvre authored and Roscoe A. Bartlett committed Oct 5, 2014
1 parent 07fe96f commit edcd8e5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config_tests/FortranMangling.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ FUNCTION(FORTRAN_MANGLING)
SET(F_FLAGS "${CMAKE_Fortran_FLAGS} ${${PROJECT_NAME}_EXTRA_LINK_FLAGS}")
TRY_COMPILE(_fcmngl ${_fcmangledir_case} ${_fcmakelists} fmangle
CMAKE_FLAGS "-DCMAKE_C_FLAGS:STRING=${C_FLAGS}"
"-DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE}"
"-DCMAKE_Fortran_FLAGS:STRING=${F_FLAGS}"
"-DCMAKE_Fortran_FLAGS_RELEASE:STRING=${CMAKE_Fortran_FLAGS_RELEASE}"
"-DCOMMON_DEFS=${COMMON_DEFS}"
OUTPUT_VARIABLE _fcmngl_output
)
Expand Down

0 comments on commit edcd8e5

Please sign in to comment.