File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -179,6 +179,22 @@ if (PYBIND11_TEST)
179
179
add_subdirectory (tests )
180
180
endif ()
181
181
182
+ include (GNUInstallDirs )
183
+
184
+ # extract project version from source
185
+ file (STRINGS "${PYBIND11_INCLUDE_DIR} /pybind11/common.h" pybind11_version_defines
186
+ REGEX "#define PYBIND11_VERSION_(MAJOR|MINOR|PATCH) " )
187
+ foreach (ver ${pybind11_version_defines} )
188
+ if (ver MATCHES "#define PYBIND11_VERSION_(MAJOR|MINOR|PATCH) +([^ ]+)$" )
189
+ set (PYBIND11_VERSION_${CMAKE_MATCH_1} "${CMAKE_MATCH_2} " CACHE INTERNAL "" )
190
+ endif ()
191
+ endforeach ()
192
+ set (${PROJECT_NAME} _VERSION ${PYBIND11_VERSION_MAJOR} .${PYBIND11_VERSION_MINOR}.${PYBIND11_VERSION_PATCH} )
193
+
182
194
if (PYBIND11_INSTALL )
183
- install (FILES ${PYBIND11_HEADERS} DESTINATION include /pybind11 )
195
+ install (FILES ${PYBIND11_HEADERS}
196
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} /pybind11 )
197
+ # GNUInstallDirs "DATADIR" wrong here; CMake search path wants "share".
198
+ set (PYBIND11_CMAKECONFIG_INSTALL_DIR "share/cmake/${PROJECT_NAME} " CACHE STRING "install path for pybind11Config.cmake" )
199
+
184
200
endif ()
You can’t perform that action at this time.
0 commit comments