summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Molteni <marco.molteni@laposte.net>2015-04-15 20:46:48 +0200
committerRoger Meier <roger@apache.org>2015-04-15 22:04:49 +0200
commit7f47792bf288c3dca049d04de06d57d2f060abba (patch)
tree78308529c1b194d87600c2eaf6c30d8b8442f80c
parenta242c28ba16012ba480c5fbac88bedceaf3aed57 (diff)
downloadthrift-7f47792bf288c3dca049d04de06d57d2f060abba.tar.gz
THRIFT-3097 cmake targets unconditionally depend on optional libraries
-rw-r--r--CMakeLists.txt6
-rw-r--r--build/cmake/DefineOptions.cmake7
-rwxr-xr-xlib/py/CMakeLists.txt2
3 files changed, 11 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2800167eb..f19f99972 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -75,7 +75,11 @@ endif()
if(WITH_CPP)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lib/cpp)
if(BUILD_TESTING)
- add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test/cpp)
+ if(WITH_LIBEVENT)
+ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test/cpp)
+ else()
+ message(WARNING "libevent not found or disabled; will not build some tests")
+ endif()
endif()
endif()
diff --git a/build/cmake/DefineOptions.cmake b/build/cmake/DefineOptions.cmake
index f2eb76d25..7d8b032ae 100644
--- a/build/cmake/DefineOptions.cmake
+++ b/build/cmake/DefineOptions.cmake
@@ -24,7 +24,7 @@ include(CMakeDependentOption)
option(BUILD_COMPILER "Build Thrift compiler" ON)
option(BUILD_TESTING "Build with unit tests" ON)
option(BUILD_EXAMPLES "Build examples" ON)
-option(BUILD_LIBRARIES "Build Thrfit libraries" ON)
+option(BUILD_LIBRARIES "Build Thrift libraries" ON)
# Libraries to build
@@ -74,9 +74,10 @@ CMAKE_DEPENDENT_OPTION(WITH_JAVA "Build Java library" ON
"BUILD_LIBRARIES;JAVA_FOUND;ANT_FOUND" OFF)
# Python
-include(FindPythonInterp QUIET)
+include(FindPythonInterp QUIET) # for Python executable
+include(FindPythonLibs QUIET) # for Python.h
CMAKE_DEPENDENT_OPTION(WITH_PYTHON "Build Python library" ON
- "BUILD_LIBRARIES;PYTHONINTERP_FOUND" OFF)
+ "BUILD_LIBRARIES;PYTHONLIBS_FOUND" OFF)
# Common library options
option(WITH_SHARED_LIB "Build shared libraries" ON)
diff --git a/lib/py/CMakeLists.txt b/lib/py/CMakeLists.txt
index e92658d32..ef987b67b 100755
--- a/lib/py/CMakeLists.txt
+++ b/lib/py/CMakeLists.txt
@@ -17,6 +17,8 @@
# under the License.
#
+include_directories(${PYTHON_INCLUDE_DIRS})
+
add_custom_target(python_build ALL
COMMAND ${PYTHON_EXECUTABLE} setup.py build
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}