Skip to content

Commit 212e0d6

Browse files
jcfrjamesobutler
authored andcommitted
cmake: Set PYTHONQT_DEBUG as target compile property
This changes the PYTHONQT_DEBUG definition from a global add_definition to a target-specific compile definition.
1 parent 0516b98 commit 212e0d6

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

CMakeLists.txt

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ include_directories("${PYTHON_INCLUDE_DIR}")
6161

6262
option(PythonQt_SUPPORT_NAME_PROPERTY "Enable PythonQt name-property support" ON)
6363
option(PythonQt_USE_RELEASE_PYTHON_FALLBACK "Fallback to Release python when Debug missing" ON)
64+
option(PythonQt_DEBUG "Enable PythonQt debug output" OFF)
6465

6566
if(NOT DEFINED PythonQt_INSTALL_RUNTIME_DIR)
6667
set(PythonQt_INSTALL_RUNTIME_DIR bin)
@@ -119,13 +120,6 @@ if(PythonQt_Wrap_QtAll)
119120
endforeach()
120121
endif()
121122

122-
option(PythonQt_DEBUG "Enable/Disable PythonQt debug output" OFF)
123-
if(PythonQt_DEBUG)
124-
add_definitions(-DPYTHONQT_DEBUG)
125-
else()
126-
remove_definitions(-DPYTHONQT_DEBUG)
127-
endif()
128-
129123
#-----------------------------------------------------------------------------
130124
# Setup Qt
131125

@@ -311,6 +305,7 @@ set_target_properties(PythonQt PROPERTIES DEFINE_SYMBOL PYTHONQT_EXPORTS)
311305

312306
target_compile_definitions(PythonQt
313307
PRIVATE
308+
$<$<BOOL:${PythonQt_DEBUG}>:PYTHONQT_DEBUG>
314309
$<$<BOOL:${PythonQt_SUPPORT_NAME_PROPERTY}>:PYTHONQT_SUPPORT_NAME_PROPERTY>
315310
PUBLIC
316311
$<$<BOOL:${PythonQt_USE_RELEASE_PYTHON_FALLBACK}>:PYTHONQT_USE_RELEASE_PYTHON_FALLBACK>

0 commit comments

Comments
 (0)