aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Kai Wasserbäch2009-07-30 22:02:07 +0000
committerGravatar Kai Wasserbäch2009-07-30 22:02:07 +0000
commit3054bdbd364157775fd5c58a818a4dc8fb7ecc57 (patch)
treed9635c90c861cbe9d3d3611a888215e7cf9cead7 /src
parent[KVIrc] (trunk) Revert r3376, r3374 didn't break Python. (diff)
downloadKVIrc-3054bdbd364157775fd5c58a818a4dc8fb7ecc57.tar.gz
KVIrc-3054bdbd364157775fd5c58a818a4dc8fb7ecc57.tar.bz2
KVIrc-3054bdbd364157775fd5c58a818a4dc8fb7ecc57.zip
[KVIrc] (trunk) Correct check for building with Python or not.
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@3394 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src')
-rw-r--r--src/modules/python/CMakeLists.txt4
-rw-r--r--src/modules/pythoncore/CMakeLists.txt41
2 files changed, 28 insertions, 17 deletions
diff --git a/src/modules/python/CMakeLists.txt b/src/modules/python/CMakeLists.txt
index 668608d4f..e240f3964 100644
--- a/src/modules/python/CMakeLists.txt
+++ b/src/modules/python/CMakeLists.txt
@@ -2,7 +2,7 @@
#
# Only build this, if WITH_PYTHON was set and passed to CMake
-IF(WANT_PYTHON)
+IF(COMPILE_PYTHON_SUPPORT)
SET(kvipython_SRCS
libkvipython.cpp
)
@@ -13,4 +13,4 @@ IF(WANT_PYTHON)
SET(kvi_module_name kvipython)
INCLUDE(${CMAKE_SOURCE_DIR}/cmake/module.rules.txt)
-ENDIF(WANT_PYTHON)
+ENDIF(COMPILE_PYTHON_SUPPORT)
diff --git a/src/modules/pythoncore/CMakeLists.txt b/src/modules/pythoncore/CMakeLists.txt
index 5630c4e6c..2d0036d27 100644
--- a/src/modules/pythoncore/CMakeLists.txt
+++ b/src/modules/pythoncore/CMakeLists.txt
@@ -1,21 +1,32 @@
# CMakeLists for src/modules/pythoncore
-#
-# Only build this if WITH_PYTHON was passed to CMake.
-IF(WANT_PYTHON)
- SET(kvipythoncore_MOC_HDRS
- pythoncoreinterface.h
- )
+SET(kvipythoncore_MOC_HDRS
+ pythoncoreinterface.h
+)
- SET(kvipythoncore_SRCS
- libkvipythoncore.cpp
- kvircmodule.cpp
- )
+SET(kvipythoncore_SRCS
+ libkvipythoncore.cpp
+ kvircmodule.cpp
+)
- # After this call, files will be moc'ed to moc_kvi_*.cpp
- QT4_WRAP_CPP(kvipythoncore_MOC_SRCS ${kvipythoncore_MOC_HDRS})
+# After this call, files will be moc'ed to moc_kvi_*.cpp
+QT4_WRAP_CPP(kvipythoncore_MOC_SRCS ${kvipythoncore_MOC_HDRS})
- SET(kvi_module_name kvipythoncore)
+SET(kvi_module_name kvipythoncore)
- INCLUDE(${CMAKE_SOURCE_DIR}/cmake/module.rules.txt)
-ENDIF(WANT_PYTHON)
+IF(COMPILE_PYTHON_SUPPORT)
+ EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE}-config --cflags
+ OUTPUT_VARIABLE PYTHON_COMPILE_FLAGS
+ )
+
+ # Remove new line characters
+ STRING(REGEX REPLACE "(\r?\n)+$" "" PYTHON_COMPILE_FLAGS "${PYTHON_COMPILE_FLAGS}")
+ # Remove leading and trailing spaces (string strip)
+ STRING(REGEX REPLACE "(^( )+|( )+$)" "" PYTHON_COMPILE_FLAGS "${PYTHON_COMPILE_FLAGS}")
+ENDIF()
+
+INCLUDE(${CMAKE_SOURCE_DIR}/cmake/module.rules.txt)
+
+IF(COMPILE_PYTHON_SUPPORT)
+ SET_TARGET_PROPERTIES(${kvi_module_name} PROPERTIES COMPILE_FLAGS "${PYTHON_COMPILE_FLAGS}")
+ENDIF()