From: Joakim SoĢˆderberg Date: Tue, 21 Jan 2014 23:06:21 +0000 (+0100) Subject: CMake: Get rid of python not found warning when regress tests turned off. X-Git-Tag: release-2.1.4-alpha~36 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d38d798b258c37342c72b3ac21f69e438c70991e;p=libevent CMake: Get rid of python not found warning when regress tests turned off. It would warn that python wasn't found when it was, just because the regress tests where turned off... confusing. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 98bd56e1..00f4aa35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -734,62 +734,64 @@ if (NOT EVENT__DISABLE_TESTS) # # Generate Regress tests. # - if (NOT EVENT__DISABLE_REGRESS AND PYTHONINTERP_FOUND) - message("Generating regress tests...") - add_definitions(-DTINYTEST_LOCAL) - add_custom_command( - OUTPUT - ${CMAKE_CURRENT_SOURCE_DIR}/test/regress.gen.c - ${CMAKE_CURRENT_SOURCE_DIR}/test/regress.gen.h - DEPENDS - event_rpcgen.py - test/regress.rpc - COMMAND ${PYTHON_EXECUTABLE} ../event_rpcgen.py regress.rpc - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test - ) - - list(APPEND SRC_REGRESS - test/regress.c - test/regress.gen.c - test/regress.gen.h - test/regress_buffer.c - test/regress_bufferevent.c - test/regress_dns.c - test/regress_et.c - test/regress_finalize.c - test/regress_http.c - test/regress_listener.c - test/regress_main.c - test/regress_minheap.c - test/regress_rpc.c - test/regress_testutils.c - test/regress_testutils.h - test/regress_util.c - test/tinytest.c - ) - - if (WIN32) - list(APPEND SRC_REGRESS test/regress_iocp.c) - list(APPEND SRC_REGRESS test/regress_thread.c) - endif() - - if (CMAKE_USE_PTHREADS_INIT) - list(APPEND SRC_REGRESS test/regress_thread.c) - endif() - - if (ZLIB_LIBRARY) - list(APPEND SRC_REGRESS test/regress_zlib.c) - endif() - - if (OPENSSL_LIBRARIES) - list(APPEND SRC_REGRESS test/regress_ssl.c) + if (NOT EVENT__DISABLE_REGRESS) + if (PYTHONINTERP_FOUND) + message("Generating regress tests...") + add_definitions(-DTINYTEST_LOCAL) + add_custom_command( + OUTPUT + ${CMAKE_CURRENT_SOURCE_DIR}/test/regress.gen.c + ${CMAKE_CURRENT_SOURCE_DIR}/test/regress.gen.h + DEPENDS + event_rpcgen.py + test/regress.rpc + COMMAND ${PYTHON_EXECUTABLE} ../event_rpcgen.py regress.rpc + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test + ) + + list(APPEND SRC_REGRESS + test/regress.c + test/regress.gen.c + test/regress.gen.h + test/regress_buffer.c + test/regress_bufferevent.c + test/regress_dns.c + test/regress_et.c + test/regress_finalize.c + test/regress_http.c + test/regress_listener.c + test/regress_main.c + test/regress_minheap.c + test/regress_rpc.c + test/regress_testutils.c + test/regress_testutils.h + test/regress_util.c + test/tinytest.c + ) + + if (WIN32) + list(APPEND SRC_REGRESS test/regress_iocp.c) + list(APPEND SRC_REGRESS test/regress_thread.c) + endif() + + if (CMAKE_USE_PTHREADS_INIT) + list(APPEND SRC_REGRESS test/regress_thread.c) + endif() + + if (ZLIB_LIBRARY) + list(APPEND SRC_REGRESS test/regress_zlib.c) + endif() + + if (OPENSSL_LIBRARIES) + list(APPEND SRC_REGRESS test/regress_ssl.c) + endif() + + add_executable(regress ${SRC_REGRESS}) + target_link_libraries(regress event ${LIB_APPS} ${LIB_PLATFORM}) + add_dependencies(regress event) + else() + message(WARNING "Python not found, cannot generate regress tests!") endif() - - add_executable(regress ${SRC_REGRESS}) - target_link_libraries(regress event ${LIB_APPS} ${LIB_PLATFORM}) - add_dependencies(regress event) - else() - message(WARNING "Python not found, cannot generate regress tests!") endif() #