Skip to content

Commit 4421ccc

Browse files
author
Zandru
committed
Find Python using cmake
Instead of setting the path to the python include dir statically, use cmake (FindPythonLibs) to get the path dynamically.
1 parent a70736e commit 4421ccc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ find_package(catkin REQUIRED COMPONENTS
1212
## System dependencies are found with CMake's conventions
1313
find_package(Boost REQUIRED COMPONENTS python)
1414

15+
find_package(PythonLibs REQUIRED) # sets ${PYTHON_INCLUDE_DIRS}
16+
1517

1618
## Uncomment this if the package has a setup.py. This macro ensures
1719
## modules and global scripts declared therein get installed
@@ -46,7 +48,7 @@ catkin_package(
4648
include_directories(
4749
${catkin_INCLUDE_DIRS}
4850
${Boost_INCLUDE_DIRS}
49-
"/usr/include/python2.7" #TODO: let cmake find the path
51+
${PYTHON_INCLUDE_DIRS}
5052
)
5153

5254
add_library(mycpplib SHARED

0 commit comments

Comments
 (0)