[cmake-developers] How should Mac frameworks work?

Stephen Kelly steveire at gmail.com
Mon Jul 1 09:59:32 EDT 2013


Brad King wrote:

> On 07/01/2013 09:17 AM, Stephen Kelly wrote:
>> However, a colleage tested it (I have no Mac to hand), and told me that
>> if those relevant lines are removed from the Config files, CMake does not
>> seem to pass the relevant -F and --framework lines to the compiler, so
>> #includes do not work.
>> 
>> Is that a missing feature in CMake that is known, or an unknown bug in a
>> case which should work?
> 
> What version of CMake and what generator did he use?

The version is 2.8.11.1 from homebrew, and the generator is the makefile 
generator.

The testcase I asked him to test with is 

 https://qt.gitorious.org/qt/qtbase/blobs/dev/tests/auto/cmake/test_concurrent_module/CMakeLists.txt

He removed the includes from the main.cpp and replaced the content with 
simply { return 0; } to see the link line:

~/Desktop/Bug32134/qtbase-opensource-src-5.1.0-
rc2/tests/auto/cmake/test_concurrent_module $ make VERBOSE=1
/usr/local/Cellar/cmake/2.8.11.1/bin/cmake -
H/Users/jmt/Desktop/Bug32134/qtbase-opensource-src-5.1.0-
rc2/tests/auto/cmake/test_concurrent_module -
B/Users/jmt/Desktop/Bug32134/qtbase-opensource-src-5.1.0-
rc2/tests/auto/cmake/test_concurrent_module --check-build-system 
CMakeFiles/Makefile.cmake 0
/usr/local/Cellar/cmake/2.8.11.1/bin/cmake -E cmake_progress_start 
/Users/jmt/Desktop/Bug32134/qtbase-opensource-src-5.1.0-
rc2/tests/auto/cmake/test_concurrent_module/CMakeFiles 
/Users/jmt/Desktop/Bug32134/qtbase-opensource-src-5.1.0-
rc2/tests/auto/cmake/test_concurrent_module/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make -f CMakeFiles/mainapp.dir/build.make CMakeFiles/mainapp.dir/depend
cd /Users/jmt/Desktop/Bug32134/qtbase-opensource-src-5.1.0-
rc2/tests/auto/cmake/test_concurrent_module && 
/usr/local/Cellar/cmake/2.8.11.1/bin/cmake -E cmake_depends "Unix Makefiles" 
/Users/jmt/Desktop/Bug32134/qtbase-opensource-src-5.1.0-
rc2/tests/auto/cmake/test_concurrent_module 
/Users/jmt/Desktop/Bug32134/qtbase-opensource-src-5.1.0-
rc2/tests/auto/cmake/test_concurrent_module 
/Users/jmt/Desktop/Bug32134/qtbase-opensource-src-5.1.0-
rc2/tests/auto/cmake/test_concurrent_module 
/Users/jmt/Desktop/Bug32134/qtbase-opensource-src-5.1.0-
rc2/tests/auto/cmake/test_concurrent_module 
/Users/jmt/Desktop/Bug32134/qtbase-opensource-src-5.1.0-
rc2/tests/auto/cmake/test_concurrent_module/CMakeFiles/mainapp.dir/DependInfo.cmake 
--color=
make -f CMakeFiles/mainapp.dir/build.make CMakeFiles/mainapp.dir/build
/usr/local/Cellar/cmake/2.8.11.1/bin/cmake -E cmake_progress_report 
/Users/jmt/Desktop/Bug32134/qtbase-opensource-src-5.1.0-
rc2/tests/auto/cmake/test_concurrent_module/CMakeFiles 1
[100%] Building CXX object CMakeFiles/mainapp.dir/main.cpp.o
/usr/bin/c++   -DQT_CONCURRENT_LIB -DQT_CORE_LIB -
I/Users/jmt/Desktop/Bug32134/dist/mkspecs/macx-clang    -o 
CMakeFiles/mainapp.dir/main.cpp.o -c /Users/jmt/Desktop/Bug32134/qtbase-
opensource-src-5.1.0-rc2/tests/auto/cmake/test_concurrent_module/main.cpp
Linking CXX executable mainapp
/usr/local/Cellar/cmake/2.8.11.1/bin/cmake -E cmake_link_script 
CMakeFiles/mainapp.dir/link.txt --verbose=1
/usr/bin/c++     -Wl,-search_paths_first -Wl,-headerpad_max_install_names   
CMakeFiles/mainapp.dir/main.cpp.o  -o mainapp  
/Users/jmt/Desktop/Bug32134/dist/lib/QtConcurrent.framework/QtConcurrent 
/Users/jmt/Desktop/Bug32134/dist/lib/QtCore.framework/QtCore
/usr/local/Cellar/cmake/2.8.11.1/bin/cmake -E cmake_progress_report 
/Users/jmt/Desktop/Bug32134/qtbase-opensource-src-5.1.0-
rc2/tests/auto/cmake/test_concurrent_module/CMakeFiles  1
[100%] Built target mainapp
/usr/local/Cellar/cmake/2.8.11.1/bin/cmake -E cmake_progress_start 
/Users/jmt/Desktop/Bug32134/qtbase-opensource-src-5.1.0-
rc2/tests/auto/cmake/test_concurrent_module/CMakeFiles 0 


He said it was interesting that full paths to the dynamic libs are used 
instead of -F and --frameworks entries. That probably relates to how the 
IMPORTED_LOCATION of the target is populated. The relevant part of the 
Qt5CoreConfig.cmake is 

 
    macro(_populate_Core_target_properties 
            Configuration LIB_LOCATION IMPLIB_LOCATION)
        set_property(TARGET Qt5::Core 
            APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
 
        set(imported_location 
            "${_qt5Core_install_prefix}/lib/${LIB_LOCATION}")
        set_target_properties(Qt5::Core 
          PROPERTIES
            "IMPORTED_LINK_INTERFACE_LIBRARIES_${Configuration}" 
                "${_Qt5Core_LIB_DEPENDENCIES}"
            "IMPORTED_LOCATION_${Configuration}" 
                ${imported_location}
    )
    endmacro()

    add_library(Qt5::Core SHARED IMPORTED)
    set_property(TARGET Qt5::Core PROPERTY FRAMEWORK 1)

    _populate_Core_target_properties(RELEASE "QtCore.framework/QtCore" "" )
 
    _populate_Core_target_properties(DEBUG "QtCore.framework/QtCore" "" )


Thanks,

Steve.





More information about the cmake-developers mailing list