Skip to content

Instantly share code, notes, and snippets.

@fpersson
Created December 30, 2011 21:43
Show Gist options
  • Save fpersson/1541605 to your computer and use it in GitHub Desktop.
Save fpersson/1541605 to your computer and use it in GitHub Desktop.
CMakeLists for python libs writen in C++ with boost::python
cmake_minimum_required (VERSION 2.8)
project(demo)
find_package(Boost 1.4.2)
find_package(Boost COMPONENTS python REQUIRED)
find_package(PythonLibs REQUIRED)
include_directories(${Boost_INCLUDE_DIR} ${PYTHON_INCLUDE_DIRS})
set(CORELIBS ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})
add_library(demo SHARED ./main.cpp)
target_link_libraries(demo ${CORELIBS})
if(CMAKE_COMPILER_IS_GNUCXX)
add_definitions("-Wall")
else()
message(FATAL_ERROR "CMakeLists.txt has not been tested/written for your compiler.")
endif()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment