[CMake] Looking for framework in OS X 10.8 with CMake 2.8.8/2, 8.9 seems to be broken

ANDREOLETTI DAVID david.andreoletti.dev at gmail.com
Tue Aug 21 20:46:28 EDT 2012


Hi everyone,

This is my first post in the mailing list as well as recent CMake user :)
However, my CMake experience has not been smooth on OS X especially when it
comes to finding frameworks. My CMakeList.txt fails to find
"boost.framework" located at /Users/Me/myproject/framework/boost.framework.
boost.framework is a framework containing Boost C++ headers and library.
The framework was created with this
script<https://github.com/davidandreoletti/boostoniphone-generic> and
targets iOS Device and iOS Simulator into a single universal binary. The
boost.framework works fine when imported into an Xcode project targeting
iOS.

When I execute CMake, the output is:

BOOST_INCLUDE_DIR is BOOST_INCLUDE_DIR-NOTFOUND
BOOST_LIBRARY is BOOST_LIBRARY-NOTFOUND
-- Could NOT find BOOSTFramework (missing:  BOOST_LIBRARY
BOOST_INCLUDE_DIR)

Here is the relevant part of the CMakeLists.txt:
--------------------------------------------------------------------

set(CROSS_PLATFORM_BOOST_FRAMEWORK_DIR /Users/Me/myproject/framework)
set(ENV{BOOST_ROOT} ${CROSS_PLATFORM_BOOST_FRAMEWORK_DIR})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
${CROSS_PLATFORM_BOOST_FRAMEWORK_DIR})
find_package(BoostFramework REQUIRED)
IF (BOOSTFramework_FOUND)
    include_directories(${BOOST_INCLUDE_DIR})
    target_link_libraries(testrunner boost)
ENDIF()

Here is the FindBoostFramework.cmake file :
--------------------------------------------------------------------

set(BOOSTFRAMEWORK_ROOT $ENV{BOOST_ROOT})
if (APPLE)
  #
  # Frameworks only exist on Apple's OSes
  #
  find_library(
    BOOST_LIBRARY
    NAMES boost
    PATHS ${BOOSTFRAMEWORK_ROOT}
    NO_DEFAULT_PATH)

  find_path(BOOST_INCLUDE_DIR
    NAMES boost/config.hpp config.hpp
    PATHS PATHS ${BOOSTFRAMEWORK_ROOT}
  )

  message("BOOST_INCLUDE_DIR is ${BOOST_INCLUDE_DIR}")
  message("BOOST_LIBRARY is ${BOOST_LIBRARY}")

  # Check if Boost is considered found
  #set(BOOST_FOUND "NO")
  if (NOT "${BOOST_INCLUDE_DIR}" STREQUAL "BOOST_INCLUDE_DIR-NOTFOUND" AND
DEFINED BOOST_LIBRARY)
    SET(BOOST_boost_LIBRARY "-framework boost" CACHE STRING "Boost
framework for OSX")
    #set(BOOST_FOUND "YES")
  endif()

  # handle the QUIETLY and REQUIRED arguments and set BOOSTFRAMEWORK_FOUND
to TRUE if
  # all listed variables are TRUE
  include(FindPackageHandleStandardArgs)
  find_package_handle_standard_args(
    BOOSTFramework
    DEFAULT_MSG
    BOOST_LIBRARY
    BOOST_INCLUDE_DIR)

  mark_as_advanced(BOOST_INCLUDE_DIR BOOST_LIBRARY)
endif (APPLE)

My environment:
------------------------
OS: OS X 10.8
Xcode 4.4
Cmake: Tried on both CMake 2.8.8 and CMake 2.8.9

FYI: I tried to load the OpenGL framework (located at
/System/Library/Frameworks/OpenGL.framework) to check whether CMake was
finding this "standard" framework but it does NOT either.

Can anyone shed some light on this ?

Regards,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120822/dc6bae1f/attachment.htm>


More information about the CMake mailing list