THRIFT-3097 cmake targets unconditionally depend on optional libraries

This commit is contained in:
Marco Molteni 2015-04-15 20:46:48 +02:00 committed by Roger Meier
parent a242c28ba1
commit 7f47792bf2
3 changed files with 11 additions and 4 deletions

View File

@ -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()

View File

@ -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)

View File

@ -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}