<div dir="ltr">Hi Bill,<div>I feel your pain. I suspect a CMake bug is hidden away somewhere causing this behavior, and have struggled with this quite a lot.</div><div><br></div><div>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:</div><div><br></div><div><div>if ( CMAKE_OSX_DEPLOYMENT_TARGET )</div><div><span class="" style="white-space:pre">     </span>  set ( CMAKE_EXE_LINKER_FLAGS</div><div><span class="" style="white-space:pre">        </span>    "${CMAKE_EXE_LINKER_FLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}" )</div><div><span class="" style="white-space:pre">  </span>endif ( CMAKE_OSX_DEPLOYMENT_TARGET )</div></div><div><br></div><div>I *suspect* this work around will fix your problem.</div><div><br></div><div>Some more details:</div><div>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:</div><div><br></div><div><div>cmake_minimum_required ( VERSION 2.8.11 FATAL_ERROR )</div><div>include ( checkOutOfSource.cmake )</div><div>include ( configurePlatform.cmake )</div><div>include ( configureBuilds.cmake )</div><div>enable_language ( C )</div><div>enable_language ( Fortran )</div><div>include ( compiler-specific-settings.cmake )</div><div>project ( myproj NONE )</div><div><br></div><div>add_subdirectory( ${CMAKE_CURRENT_SOURCE_DIR}/src )</div></div><div><br></div><div>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.</div><div><br></div><div>In configurePlatform.cmake I have:</div><div><br></div><div><div>  if ( APPLE )</div><div>    set ( CMAKE_OSX_DEPLOYMENT_TARGET "10.6"</div><div>      CACHE STRING "Oldest OS X version to compile and link for." )</div><div>    set_property ( CACHE CMAKE_OSX_DEPLOYMENT_TARGET PROPERTY STRINGS</div><div>      "10.6" "10.7" "10.8" "10.9" )</div></div><div><div class="gmail_extra">…</div><div class="gmail_extra"><br></div><div class="gmail_extra">and then in compiler specific settings I have the modification to the linker flags given above.</div><div class="gmail_extra"><br></div><div class="gmail_extra">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.</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br clear="all"><div>Izaak Beekman<br>===================================<br>(301)244-9367<br>Princeton University Doctoral Candidate<br>Mechanical and Aerospace Engineering<br><a href="mailto:ibeekman@princeton.edu" target="_blank">ibeekman@princeton.edu</a><br><br>UMD-CP Visiting Graduate Student<br>Aerospace Engineering<br><a href="mailto:ibeekman@umiacs.umd.edu" target="_blank">ibeekman@umiacs.umd.edu</a><br><a href="mailto:ibeekman@umd.edu" target="_blank">ibeekman@umd.edu</a></div>
<br><div class="gmail_quote">On Fri, Oct 24, 2014 at 12:45 PM,  <span dir="ltr"><<a href="mailto:cmake-request@cmake.org" target="_blank">cmake-request@cmake.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Send CMake mailing list submissions to<br>
        <a href="mailto:cmake@cmake.org">cmake@cmake.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="http://public.kitware.com/mailman/listinfo/cmake" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br>
or, via email, send a message with subject or body 'help' to<br>
        <a href="mailto:cmake-request@cmake.org">cmake-request@cmake.org</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:cmake-owner@cmake.org">cmake-owner@cmake.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of CMake digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
   1. Re: Fwd: Error in compiling OKULAR using CMAKE<br>
      (<a href="mailto:lfdominguez@estudiantes.uci.cu">lfdominguez@estudiantes.uci.cu</a>)<br>
   2. Re: The new <a href="http://cmake.org" target="_blank">cmake.org</a> web site (Robert Maynard)<br>
   3. OS X Fortran flags (Bill Somerville)<br>
   4. Re: OS X Fortran flags (Bill Somerville)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Fri, 24 Oct 2014 02:29:51 +0000<br>
From: <a href="mailto:lfdominguez@estudiantes.uci.cu">lfdominguez@estudiantes.uci.cu</a><br>
To: <a href="mailto:cmake@cmake.org">cmake@cmake.org</a><br>
Subject: Re: [CMake] Fwd: Error in compiling OKULAR using CMAKE<br>
Message-ID: <2905201.UkD8Wta6Ld@envy><br>
Content-Type: text/plain; charset="iso-8859-1"<br>
<br>
On Friday 24 October 2014 11:49:55 AM Sahil Sehgal wrote:<br>
<br>
<br>
<br>
<br>
Hello,<br>
<br>
<br>
<br>
I was trying to build Okular (KDE application) in IDE (QT-creator and Kdevelop<br>
both). I did the following steps:<br>
<br>
<br>
1.) clonned the source code of Okular<br>
<br>
<br>
2.) loaded the source code in IDE<br>
<br>
<br>
3.) click on the build command.<br>
<br>
<br>
<br>
I got the following error<br>
<br>
<br>
<br>
*/home/sahil/my/New Folder/prog/okular/build> /usr/bin/cmake -<br>
DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Debug<br>
'/home/sahil/my/New Folder/prog/okular/'-- Found Qt-Version 5.2.1 (using<br>
/usr/bin/qmake)CMake Error: The following variables are used in this project, but<br>
they are set to NOTFOUND.Please set them or make sure they are set and tested<br>
correctly in the CMake files:QT_QT_INCLUDE_DIR   used as include directory in<br>
directory /home/sahil/my/New Folder/prog/okular/build/CMakeFiles/CMakeTmp<br>
<br>
CMake Error: Internal CMake error, TryCompile configure of cmake failed<br>
<br>
CMake Error at<br>
/usr/share/kde4/apps/cmake/modules/FindKDE4Internal.cmake:1316 (message):<br>
Unable to compile a basic Qt application.  Qt has not been found correctly.Call<br>
Stack (most recent call first):  /usr/share/cmake-2.8/Modules/FindKDE4.cmake:95<br>
(find_package)  CMakeLists.txt:3 (find_package)<br>
<br>
<br>
-- Configuring incomplete, errors occurred!See also "/home/sahil/my/New<br>
Folder/prog/okular/build/CMakeFiles/CMakeOutput.log".See also<br>
"/home/sahil/my/New Folder/prog/okular/build/CMakeFiles/CMakeError.log".***<br>
Failure: Exit code 1 ***<br>
<br>
*<br>
Please suggest the possible solution<br>
<br>
<br>
<br>
Regards<br>
<br>
<br>
Sahil Sehgal<br>
<br>
<br>
<br>
<br>
<br>
<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://public.kitware.com/pipermail/cmake/attachments/20141024/b62f04c8/attachment-0001.html" target="_blank">http://public.kitware.com/pipermail/cmake/attachments/20141024/b62f04c8/attachment-0001.html</a>><br>
-------------- next part --------------<br>
A non-text attachment was scrubbed...<br>
Name: signature.asc<br>
Type: application/pgp-signature<br>
Size: 819 bytes<br>
Desc: This is a digitally signed message part.<br>
URL: <<a href="http://public.kitware.com/pipermail/cmake/attachments/20141024/b62f04c8/attachment-0001.sig" target="_blank">http://public.kitware.com/pipermail/cmake/attachments/20141024/b62f04c8/attachment-0001.sig</a>><br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Fri, 24 Oct 2014 08:01:52 -0400<br>
From: Robert Maynard <<a href="mailto:robert.maynard@kitware.com">robert.maynard@kitware.com</a>><br>
To: David Cole <<a href="mailto:DLRdave@aol.com">DLRdave@aol.com</a>><br>
Cc: "<a href="mailto:cmake@cmake.org">cmake@cmake.org</a>" <<a href="mailto:cmake@cmake.org">cmake@cmake.org</a>><br>
Subject: Re: [CMake] The new <a href="http://cmake.org" target="_blank">cmake.org</a> web site<br>
Message-ID:<br>
        <<a href="mailto:CAFzjYVooSBGPTk-xnJTVkhMwmvaRWY%2Ban3x63%2BK9-qhFoycMgw@mail.gmail.com">CAFzjYVooSBGPTk-xnJTVkhMwmvaRWY+an3x63+K9-qhFoycMgw@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Thanks for finding the broken link, I have correct the url and everything<br>
should be working now.<br>
<br>
On Thu, Oct 23, 2014 at 8:23 PM, David Cole via CMake <<a href="mailto:cmake@cmake.org">cmake@cmake.org</a>><br>
wrote:<br>
<br>
> The new CMake web site looks fantastic! Even on my phone... Kudos to<br>
> everybody involved in making it look pretty after all these years of,<br>
> well, ahem, looking slightly less pretty.......<br>
><br>
> However, on this page:<br>
> <a href="http://www.cmake.org/developer-resources/" target="_blank">http://www.cmake.org/developer-resources/</a><br>
><br>
> The "Dashboard" icon is a broken link. 404.<br>
><br>
> But, besides that, nice work!<br>
><br>
><br>
> Cheers,<br>
> David C.<br>
> --<br>
><br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Please keep messages on-topic and check the CMake FAQ at:<br>
> <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
><br>
> Kitware offers various services to support the CMake community. For more<br>
> information on each offering, please visit:<br>
><br>
> CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
> CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
> CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://public.kitware.com/mailman/listinfo/cmake" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://public.kitware.com/pipermail/cmake/attachments/20141024/18d7da53/attachment-0001.html" target="_blank">http://public.kitware.com/pipermail/cmake/attachments/20141024/18d7da53/attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
Message: 3<br>
Date: Fri, 24 Oct 2014 16:31:49 +0100<br>
From: Bill Somerville <<a href="mailto:bill@classdesign.com">bill@classdesign.com</a>><br>
To: CMake ML <<a href="mailto:cmake@cmake.org">cmake@cmake.org</a>><br>
Subject: [CMake] OS X Fortran flags<br>
Message-ID: <<a href="mailto:544A70E5.3040807@classdesign.com">544A70E5.3040807@classdesign.com</a>><br>
Content-Type: text/plain; charset=utf-8; format=flowed<br>
<br>
Hi,<br>
<br>
I am building some Fortran sources and on Mac I want to make the<br>
resulting executable portable back to 10.7.<br>
<br>
So I have:<br>
<br>
if (APPLE)<br>
   set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")<br>
   set (CMAKE_OSX_DEPLOYMENT_TARGET 10.7) # Earliest version we can<br>
support with C++11 & libc++<br>
   set (CMAKE_OSX_SYSROOT<br>
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk)<br>
endif (APPLE)<br>
<br>
in my CMakeLists.txt.<br>
<br>
I am building on a 10.8 system with the 10.9 SDK installed.<br>
<br>
This all works as expected with the C and C++ sources in the project but<br>
the Fortran compiles are not being passed the relevant options:<br>
<br>
-isysroot<br>
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk<br>
-mmacosx_version_min=10.7<br>
<br>
The Fortran compiler is the MacPorts gcc49 itself built from sources<br>
using the same options so that the distributable libraries reference the<br>
correct system library function versions.<br>
<br>
So what am I missing? A brief scan of the CMake sources looks like it<br>
should be doing this right for GNU compilers as the compiler tests<br>
should check for those options being supported and supply them.<br>
<br>
Do I have to add these options to the FFLAGS in my CMakeLists.txt?<br>
<br>
Regards<br>
Bill.<br>
<br>
<br>
------------------------------<br>
<br>
Message: 4<br>
Date: Fri, 24 Oct 2014 17:44:56 +0100<br>
From: Bill Somerville <<a href="mailto:bill@classdesign.com">bill@classdesign.com</a>><br>
To: <a href="mailto:cmake@cmake.org">cmake@cmake.org</a><br>
Subject: Re: [CMake] OS X Fortran flags<br>
Message-ID: <<a href="mailto:544A8208.7030602@classdesign.com">544A8208.7030602@classdesign.com</a>><br>
Content-Type: text/plain; charset=windows-1252; format=flowed<br>
<br>
A small correction:<br>
<br>
On 24/10/2014 16:31, Bill Somerville wrote:<br>
> Hi,<br>
><br>
> I am building some Fortran sources and on Mac I want to make the<br>
> resulting executable portable back to 10.7.<br>
><br>
> So I have:<br>
><br>
> if (APPLE)<br>
>   set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")<br>
>   set (CMAKE_OSX_DEPLOYMENT_TARGET 10.7) # Earliest version we can<br>
> support with C++11 & libc++<br>
>   set (CMAKE_OSX_SYSROOT<br>
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk)<br>
> endif (APPLE)<br>
><br>
> in my CMakeLists.txt.<br>
><br>
> I am building on a 10.8 system with the 10.9 SDK installed.<br>
><br>
> This all works as expected with the C and C++ sources in the project<br>
> but the Fortran compiles are not being passed the relevant options:<br>
><br>
> -isysroot<br>
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk<br>
> -mmacosx_version_min=10.7<br>
-mmacosx-version-min=10.7<br>
><br>
> The Fortran compiler is the MacPorts gcc49 itself built from sources<br>
> using the same options so that the distributable libraries reference<br>
> the correct system library function versions.<br>
><br>
> So what am I missing? A brief scan of the CMake sources looks like it<br>
> should be doing this right for GNU compilers as the compiler tests<br>
> should check for those options being supported and supply them.<br>
><br>
> Do I have to add these options to the FFLAGS in my CMakeLists.txt?<br>
><br>
> Regards<br>
> Bill.<br>
<br>
<br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<br>
<br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br>
<br>
------------------------------<br>
<br>
End of CMake Digest, Vol 126, Issue 28<br>
**************************************<br>
</blockquote></div><br></div></div></div>