Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- # CMakeLists.txt - cmake build file for API Design examples
- #
- # Martin Reddy, 1 Jan 2010 - http://APIBook.com/
- #
- # Declare the minimum version of cmake that we need
- cmake_minimum_required(VERSION 2.4)
- #
- # to get this to work properly, you need to add include paths to:
- #
- # 1. Your Python header files
- # 2. Your Boost installation
- #
- # and add to your lib paths:
- #
- # 1. The directory where libpython lives
- # 2. The directory where libboost_python lives
- #
- # Note: The version of Python you specify MUST be the same version that Boost.Python
- # was compiled against otherwise you'll get lots of errors.
- #
- #
- # this figures out the Python include directories and adds them to the
- # header file search path
- #
- execute_process(
- COMMAND python-config --includes
- COMMAND sed -r "s/-I//g; s/ +/;/g"
- COMMAND tr -d '\n'
- OUTPUT_VARIABLE Python_Includes
- )
- include_directories(${Python_Includes})
- # find BOOST and boost-python
- find_package( Boost COMPONENTS python REQUIRED)
- if(Boost_FOUND)
- include_directories(${Boost_INCLUDE_DIRS})
- MESSAGE(STATUS "Boost_LIB_VERSION: " ${Boost_LIB_VERSION})
- MESSAGE(STATUS "Boost_INCLUDE_DIRS are: " ${Boost_INCLUDE_DIRS})
- MESSAGE(STATUS "Boost_PYTHON_LIBRARY is: " ${Boost_PYTHON_LIBRARY})
- MESSAGE(STATUS "boost_LIBRARY_DIRS is: " ${Boost_LIBRARY_DIRS})
- MESSAGE(STATUS "Boost_LIBRARIES is: " ${Boost_LIBRARIES})
- endif()
- include_directories(${Boost_INCLUDE_DIRS})
- # build the library
- add_library(phonebook SHARED phonebook.cpp phonebook_wrap.cpp)
- target_link_libraries(phonebook ${Boost_LIBRARIES})
- # on Darwin/Linux, create phonebook.so, not libphonebook.dylib or libphonebook.so
- set_target_properties(phonebook PROPERTIES PREFIX "")
- if ("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
- #set_target_properties(phonebook PROPERTIES OUTPUT_NAME phonebook)
- set_target_properties(phonebook PROPERTIES SUFFIX .so)
- endif ()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement