Advertisement
Guest User

Untitled

a guest
Nov 25th, 2011
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CMake 1.91 KB | None | 0 0
  1. #
  2. # CMakeLists.txt - cmake build file for API Design examples
  3. #
  4. # Martin Reddy, 1 Jan 2010 - http://APIBook.com/
  5. #
  6.  
  7. # Declare the minimum version of cmake that we need
  8. cmake_minimum_required(VERSION 2.4)
  9.  
  10. #
  11. # to get this to work properly, you need to add include paths to:
  12. #
  13. #  1. Your Python header files
  14. #  2. Your Boost installation
  15. #
  16. # and add to your lib paths:
  17. #
  18. #  1. The directory where libpython lives
  19. #  2. The directory where libboost_python lives
  20. #
  21. # Note: The version of Python you specify MUST be the same version that Boost.Python
  22. # was compiled against otherwise you'll get lots of errors.
  23. #
  24.  
  25. #
  26. # this figures out the Python include directories and adds them to the
  27. # header file search path
  28. #
  29. execute_process(
  30.     COMMAND python-config --includes
  31.     COMMAND sed -r "s/-I//g; s/ +/;/g"
  32.     COMMAND tr -d '\n'
  33.     OUTPUT_VARIABLE Python_Includes
  34. )
  35. include_directories(${Python_Includes})
  36.  
  37. # find BOOST and boost-python
  38. find_package( Boost COMPONENTS python REQUIRED)
  39. if(Boost_FOUND)
  40.     include_directories(${Boost_INCLUDE_DIRS})
  41.     MESSAGE(STATUS "Boost_LIB_VERSION: " ${Boost_LIB_VERSION})
  42.     MESSAGE(STATUS "Boost_INCLUDE_DIRS are: " ${Boost_INCLUDE_DIRS})
  43.     MESSAGE(STATUS "Boost_PYTHON_LIBRARY is: " ${Boost_PYTHON_LIBRARY})
  44.     MESSAGE(STATUS "boost_LIBRARY_DIRS is: " ${Boost_LIBRARY_DIRS})
  45.     MESSAGE(STATUS "Boost_LIBRARIES is: " ${Boost_LIBRARIES})    
  46. endif()
  47.  
  48. include_directories(${Boost_INCLUDE_DIRS})
  49.  
  50.  
  51. # build the library
  52. add_library(phonebook SHARED phonebook.cpp phonebook_wrap.cpp)
  53. target_link_libraries(phonebook ${Boost_LIBRARIES})
  54.  
  55. # on Darwin/Linux, create phonebook.so, not libphonebook.dylib or libphonebook.so
  56. set_target_properties(phonebook PROPERTIES PREFIX "")
  57. if ("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
  58.   #set_target_properties(phonebook PROPERTIES OUTPUT_NAME phonebook)
  59.   set_target_properties(phonebook PROPERTIES SUFFIX .so)
  60. endif ()
  61.  
  62.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement