Skip to content

Commit ef65167

Browse files
committed
cmake: support PARTIO_BUILD_PYTHON
1 parent b6f062a commit ef65167

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ if (ZLIB_FOUND)
130130
list(APPEND PARTIO_LIBRARIES ZLIB::ZLIB)
131131
endif()
132132

133+
if (PARTIO_BUILD_PYTHON)
134+
find_package(Python REQUIRED COMPONENTS Interpreter Development)
135+
endif()
136+
133137
## Traverse subdirectories
134138
add_subdirectory(src/lib)
135139
if (PARTIO_BUILD_TOOLS)
@@ -138,7 +142,6 @@ if (PARTIO_BUILD_TOOLS)
138142
add_subdirectory(src/tools)
139143
endif()
140144
if (PARTIO_BUILD_PYTHON)
141-
find_package(Python REQUIRED COMPONENTS Interpreter Development)
142145
add_subdirectory(src/py)
143146
endif()
144147
if (PARTIO_BUILD_DOCS)

src/tools/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,7 @@ install(PROGRAMS partedit.py DESTINATION ${CMAKE_INSTALL_BINDIR} RENAME partedit
6767
install(PROGRAMS partjson.py DESTINATION ${CMAKE_INSTALL_BINDIR} RENAME partjson)
6868
install(PROGRAMS partinspect.py DESTINATION ${CMAKE_INSTALL_BINDIR} RENAME partinspect)
6969

70-
set(PYTHON_DEST "${CMAKE_INSTALL_LIBDIR}/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages" )
71-
install(FILES partedit.py partjson.py partinspect.py DESTINATION ${PYTHON_DEST})
70+
if (PARTIO_BUILD_PYTHON)
71+
set(PYTHON_DEST "${CMAKE_INSTALL_LIBDIR}/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages" )
72+
install(FILES partedit.py partjson.py partinspect.py DESTINATION ${PYTHON_DEST})
73+
endif()

0 commit comments

Comments
 (0)