[CMake] OS X Fortran flags

Bill Somerville bill at classdesign.com
Fri Oct 24 12:44:56 EDT 2014


A small correction:

On 24/10/2014 16:31, Bill Somerville wrote:
> Hi,
>
> I am building some Fortran sources and on Mac I want to make the 
> resulting executable portable back to 10.7.
>
> So I have:
>
> if (APPLE)
>   set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
>   set (CMAKE_OSX_DEPLOYMENT_TARGET 10.7) # Earliest version we can 
> support with C++11 & libc++
>   set (CMAKE_OSX_SYSROOT 
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk)
> endif (APPLE)
>
> in my CMakeLists.txt.
>
> I am building on a 10.8 system with the 10.9 SDK installed.
>
> This all works as expected with the C and C++ sources in the project 
> but the Fortran compiles are not being passed the relevant options:
>
> -isysroot 
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk
> -mmacosx_version_min=10.7
-mmacosx-version-min=10.7
>
> The Fortran compiler is the MacPorts gcc49 itself built from sources 
> using the same options so that the distributable libraries reference 
> the correct system library function versions.
>
> So what am I missing? A brief scan of the CMake sources looks like it 
> should be doing this right for GNU compilers as the compiler tests 
> should check for those options being supported and supply them.
>
> Do I have to add these options to the FFLAGS in my CMakeLists.txt?
>
> Regards
> Bill.



More information about the CMake mailing list