The following issue has been SUBMITTED. ====================================================================== http://public.kitware.com/Bug/view.php?id=13579 ====================================================================== Reported By: Jordan Lefebvre Assigned To: ====================================================================== Project: CMake Issue ID: 13579 Category: Modules Reproducibility: always Severity: major Priority: high Status: new ====================================================================== Date Submitted: 2012-10-09 11:16 EDT Last Modified: 2012-10-09 11:16 EDT ====================================================================== Summary: FortranCInterface.cmake does not pass CMAKE_BUILD_TYPE flags Description: In attempting to compile a mixed language static Windows executable, FortranCInterface.cmake breaks the cmake configuration.
Windows MSVC and Intel compilers toggle between static and dynamic system/compiler libraries using /MT and /MD compiler flags respectively. /libs:static /threads and /libs:dll /threads are equivalent to /MT and /MD respectively. The issues stems from a difference in initialization across C/CXX flags and Fortran flags. The static/dynamic flags are initialized in the base CMAKE_Fortran_FLAGS while they are initialized in the CMAKE_[C|CXX}_FLAGS_<CMAKE_BUILD_TYPE> flags. FortranCInterface.cmake does not pass the BUILD_TYPE flags through to the subproject. This results in mixed dynamic and static libraries and multiply defined symbols at linking. Steps to Reproduce: 1) Create cmake configuration which utilizes FortranCInterface. 2) Use Intel compilers on Windows 3) Add these additional configuration options to a configuration script.bat: cmake ^ -D CMAKE_C_FLAGS:STRING="/DWIN32 /D_WINDOWS /W3 /Zm1000" ^ -D CMAKE_CXX_FLAGS:STRING="/DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR" ^ -D CMAKE_Fortran_FLAGS:STRING="/W1 /nologo /fpp" ^ -D CMAKE_C_FLAGS_RELEASE:STRING="/D_NDEBUG /O2 /MT" ^ -D CMAKE_CXX_FLAGS_RELEASE:STRING="/DNDEBUG /O2 /MT" ^ -D CMAKE_Fortran_FLAGS_RELEASE:STRING="/D_NDEBUG /O2 /MT" ^ -D CMAKE_Fortran_COMPILER:STRING=ifort ^ -D CMAKE_CXX_COMPILER:STRING=icl ^ -D CMAKE_C_COMPILER:STRING=icl ^ -G "NMake Makefiles" ^ %* 4) initialize Intel development environment 5) run script.bat path/to/src Additional Information: This could be fixed by standardizing the initialization of compiler flags across all languages or passing all compiler flags through to the FortranCInterface subproject. This prevents a static Windows build for executable deployment. It would be convenient to have this fixed as soon as possible. ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 2012-10-09 11:16 Jordan LefebvreNew Issue ====================================================================== -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers