Hi Bill, I feel your pain. I suspect a CMake bug is hidden away somewhere causing this behavior, and have struggled with this quite a lot.
I *think* explicitly passing the relevant option to the linker fixes this, although I have some other CMake/Fortran/Mac hackery happening in my CMakeLists.txt and I can't remember the reasoning for everything. The following is wrapped in something like if(APPLE), and annoyingly, a slightly different form needs to be used if passing this flag to the linker when using the Intel compilers: if ( CMAKE_OSX_DEPLOYMENT_TARGET ) set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}" ) endif ( CMAKE_OSX_DEPLOYMENT_TARGET ) I *suspect* this work around will fix your problem. Some more details: I can't seem to follow my reasoning for exactly what hacks fixed what problems; essentially I wanted to build a redistributable binary for Mac using Fortran sources. Some of my hackery might be to allow for statically linked builds, but here is my basic approach. First the main CMakeLists.txt file: cmake_minimum_required ( VERSION 2.8.11 FATAL_ERROR ) include ( checkOutOfSource.cmake ) include ( configurePlatform.cmake ) include ( configureBuilds.cmake ) enable_language ( C ) enable_language ( Fortran ) include ( compiler-specific-settings.cmake ) project ( myproj NONE ) add_subdirectory( ${CMAKE_CURRENT_SOURCE_DIR}/src ) Have found that the order of setting certain variables can make a big difference, and that some are better set before the project command or between the enable_language and project command. The other relevant commands are in configurePlatform.cmake and compiler-specific-settings.cmake. In configurePlatform.cmake I have: if ( APPLE ) set ( CMAKE_OSX_DEPLOYMENT_TARGET "10.6" CACHE STRING "Oldest OS X version to compile and link for." ) set_property ( CACHE CMAKE_OSX_DEPLOYMENT_TARGET PROPERTY STRINGS "10.6" "10.7" "10.8" "10.9" ) ... and then in compiler specific settings I have the modification to the linker flags given above. I hope this fixes your issue, and that someone with more intimate knowledge of CMake can work on Fortran support using different compilers on Mac. Izaak Beekman =================================== (301)244-9367 Princeton University Doctoral Candidate Mechanical and Aerospace Engineering ibeek...@princeton.edu UMD-CP Visiting Graduate Student Aerospace Engineering ibeek...@umiacs.umd.edu ibeek...@umd.edu On Fri, Oct 24, 2014 at 12:45 PM, <cmake-requ...@cmake.org> wrote: > Send CMake mailing list submissions to > cmake@cmake.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://public.kitware.com/mailman/listinfo/cmake > or, via email, send a message with subject or body 'help' to > cmake-requ...@cmake.org > > You can reach the person managing the list at > cmake-ow...@cmake.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of CMake digest..." > > > Today's Topics: > > 1. Re: Fwd: Error in compiling OKULAR using CMAKE > (lfdoming...@estudiantes.uci.cu) > 2. Re: The new cmake.org web site (Robert Maynard) > 3. OS X Fortran flags (Bill Somerville) > 4. Re: OS X Fortran flags (Bill Somerville) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Fri, 24 Oct 2014 02:29:51 +0000 > From: lfdoming...@estudiantes.uci.cu > To: cmake@cmake.org > Subject: Re: [CMake] Fwd: Error in compiling OKULAR using CMAKE > Message-ID: <2905201.UkD8Wta6Ld@envy> > Content-Type: text/plain; charset="iso-8859-1" > > On Friday 24 October 2014 11:49:55 AM Sahil Sehgal wrote: > > > > > Hello, > > > > I was trying to build Okular (KDE application) in IDE (QT-creator and > Kdevelop > both). I did the following steps: > > > 1.) clonned the source code of Okular > > > 2.) loaded the source code in IDE > > > 3.) click on the build command. > > > > I got the following error > > > > */home/sahil/my/New Folder/prog/okular/build> /usr/bin/cmake - > DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Debug > '/home/sahil/my/New Folder/prog/okular/'-- Found Qt-Version 5.2.1 (using > /usr/bin/qmake)CMake Error: The following variables are used in this > project, but > they are set to NOTFOUND.Please set them or make sure they are set and > tested > correctly in the CMake files:QT_QT_INCLUDE_DIR used as include directory > in > directory /home/sahil/my/New Folder/prog/okular/build/CMakeFiles/CMakeTmp > > CMake Error: Internal CMake error, TryCompile configure of cmake failed > > CMake Error at > /usr/share/kde4/apps/cmake/modules/FindKDE4Internal.cmake:1316 (message): > Unable to compile a basic Qt application. Qt has not been found > correctly.Call > Stack (most recent call first): > /usr/share/cmake-2.8/Modules/FindKDE4.cmake:95 > (find_package) CMakeLists.txt:3 (find_package) > > > -- Configuring incomplete, errors occurred!See also "/home/sahil/my/New > Folder/prog/okular/build/CMakeFiles/CMakeOutput.log".See also > "/home/sahil/my/New Folder/prog/okular/build/CMakeFiles/CMakeError.log".*** > Failure: Exit code 1 *** > > * > Please suggest the possible solution > > > > Regards > > > Sahil Sehgal > > > > > > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://public.kitware.com/pipermail/cmake/attachments/20141024/b62f04c8/attachment-0001.html > > > -------------- next part -------------- > A non-text attachment was scrubbed... > Name: signature.asc > Type: application/pgp-signature > Size: 819 bytes > Desc: This is a digitally signed message part. > URL: < > http://public.kitware.com/pipermail/cmake/attachments/20141024/b62f04c8/attachment-0001.sig > > > > ------------------------------ > > Message: 2 > Date: Fri, 24 Oct 2014 08:01:52 -0400 > From: Robert Maynard <robert.mayn...@kitware.com> > To: David Cole <dlrd...@aol.com> > Cc: "cmake@cmake.org" <cmake@cmake.org> > Subject: Re: [CMake] The new cmake.org web site > Message-ID: > < > cafzjyvoosbgptk-xnjtvkhmwmvarwy+an3x63+k9-qhfoyc...@mail.gmail.com> > Content-Type: text/plain; charset="utf-8" > > Thanks for finding the broken link, I have correct the url and everything > should be working now. > > On Thu, Oct 23, 2014 at 8:23 PM, David Cole via CMake <cmake@cmake.org> > wrote: > > > The new CMake web site looks fantastic! Even on my phone... Kudos to > > everybody involved in making it look pretty after all these years of, > > well, ahem, looking slightly less pretty....... > > > > However, on this page: > > http://www.cmake.org/developer-resources/ > > > > The "Dashboard" icon is a broken link. 404. > > > > But, besides that, nice work! > > > > > > Cheers, > > David C. > > -- > > > > Powered by www.kitware.com > > > > Please keep messages on-topic and check the CMake FAQ at: > > http://www.cmake.org/Wiki/CMake_FAQ > > > > Kitware offers various services to support the CMake community. For more > > information on each offering, please visit: > > > > CMake Support: http://cmake.org/cmake/help/support.html > > CMake Consulting: http://cmake.org/cmake/help/consulting.html > > CMake Training Courses: http://cmake.org/cmake/help/training.html > > > > Visit other Kitware open-source projects at > > http://www.kitware.com/opensource/opensource.html > > > > Follow this link to subscribe/unsubscribe: > > http://public.kitware.com/mailman/listinfo/cmake > > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://public.kitware.com/pipermail/cmake/attachments/20141024/18d7da53/attachment-0001.html > > > > ------------------------------ > > Message: 3 > Date: Fri, 24 Oct 2014 16:31:49 +0100 > From: Bill Somerville <b...@classdesign.com> > To: CMake ML <cmake@cmake.org> > Subject: [CMake] OS X Fortran flags > Message-ID: <544a70e5.3040...@classdesign.com> > Content-Type: text/plain; charset=utf-8; format=flowed > > 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 > > 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. > > > ------------------------------ > > Message: 4 > Date: Fri, 24 Oct 2014 17:44:56 +0100 > From: Bill Somerville <b...@classdesign.com> > To: cmake@cmake.org > Subject: Re: [CMake] OS X Fortran flags > Message-ID: <544a8208.7030...@classdesign.com> > Content-Type: text/plain; charset=windows-1252; format=flowed > > 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. > > > > ------------------------------ > > Subject: Digest Footer > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake > > ------------------------------ > > End of CMake Digest, Vol 126, Issue 28 > ************************************** >
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake