CMakeLists.txt revision 81558c3f
17d09751dSDmitri Tikhonov# Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. 250aadb33SDmitri Tikhonovcmake_minimum_required(VERSION 2.8) 350aadb33SDmitri Tikhonov 450aadb33SDmitri Tikhonov 5b1af35d6SDmitri TikhonovPROJECT(lsquic C) 6461e84d8SAmol Deshpande 79a690580SDmitri TikhonovOPTION(LSQUIC_FIU "Use Fault Injection in Userspace (FIU)" OFF) 89a690580SDmitri TikhonovOPTION(LSQUIC_BIN "Compile example binaries that use the library" ON) 99a690580SDmitri TikhonovOPTION(LSQUIC_TESTS "Compile library unit tests" ON) 109a690580SDmitri Tikhonov 1112693a01SDmitri TikhonovIF (CMAKE_SYSTEM_NAME STREQUAL "Linux") 1212693a01SDmitri Tikhonov # If using older glibc, need to link with -lrt. See clock_getres(2). 1312693a01SDmitri Tikhonov EXECUTE_PROCESS( 1412693a01SDmitri Tikhonov COMMAND ${PROJECT_SOURCE_DIR}/print-glibc-version.sh ${CMAKE_C_COMPILER} 1512693a01SDmitri Tikhonov OUTPUT_VARIABLE GLIBC_VERSION) 1612693a01SDmitri Tikhonov IF(NOT GLIBC_VERSION EQUAL "" AND GLIBC_VERSION VERSION_LESS 2.17) 1712693a01SDmitri Tikhonov SET(LIBS ${LIBS} rt) 1812693a01SDmitri Tikhonov ENDIF() 1921c6983aSRahul JadhavELSEIF (CMAKE_SYSTEM_NAME STREQUAL "Android") 2021c6983aSRahul Jadhav # for android-ndk >= r19b 2121c6983aSRahul Jadhav set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY "BOTH") 2221c6983aSRahul Jadhav set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE "BOTH") 2321c6983aSRahul Jadhav set(CMAKE_FIND_ROOT_PATH_MODE_PATH "BOTH") 24ccd74161SDmitri TikhonovENDIF() 25ccd74161SDmitri Tikhonov 261e75f938SDmitri TikhonovIF("${CMAKE_BUILD_TYPE}" STREQUAL "") 271e75f938SDmitri Tikhonov SET(CMAKE_BUILD_TYPE Debug) 2850aadb33SDmitri TikhonovENDIF() 2950aadb33SDmitri Tikhonov 301e75f938SDmitri TikhonovMESSAGE(STATUS "Build type: ${CMAKE_BUILD_TYPE}") 3150aadb33SDmitri Tikhonov 32a0e1aeeeSDmitri TikhonovIF (NOT "$ENV{EXTRA_CFLAGS}" MATCHES "-DLSQUIC_DEBUG_NEXT_ADV_TICK") 33a0e1aeeeSDmitri Tikhonov SET(MY_CMAKE_FLAGS "-DLSQUIC_DEBUG_NEXT_ADV_TICK=1") 34a0e1aeeeSDmitri TikhonovENDIF() 35b93f59beSBob Perper 3646a5b669SDmitri TikhonovIF (NOT MSVC) 37461e84d8SAmol Deshpande 3850aadb33SDmitri TikhonovSET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -Wall -Wextra -Wno-unused-parameter") 3950aadb33SDmitri TikhonovSET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -fno-omit-frame-pointer") 405392f7a3SLiteSpeed TechINCLUDE(CheckCCompilerFlag) 415392f7a3SLiteSpeed TechCHECK_C_COMPILER_FLAG(-Wno-implicit-fallthrough HAS_NO_IMPLICIT_FALLTHROUGH) 425392f7a3SLiteSpeed TechIF (HAS_NO_IMPLICIT_FALLTHROUGH) 435392f7a3SLiteSpeed Tech SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -Wno-implicit-fallthrough") 445392f7a3SLiteSpeed TechENDIF() 4550aadb33SDmitri Tikhonov 46e0197994SDmitri TikhonovIF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9.3) 4750aadb33SDmitri Tikhonov SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -Wno-missing-field-initializers") 4850aadb33SDmitri TikhonovENDIF() 495392f7a3SLiteSpeed Tech 50662de5e1SDmitri TikhonovIF(LSQUIC_FIU) 51662de5e1SDmitri Tikhonov SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -DFIU_ENABLE=1") 52662de5e1SDmitri Tikhonov SET(LIBS ${LIBS} fiu) 53662de5e1SDmitri TikhonovENDIF() 54662de5e1SDmitri Tikhonov 551e75f938SDmitri TikhonovIF(CMAKE_BUILD_TYPE STREQUAL "Debug") 5650aadb33SDmitri Tikhonov SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -O0 -g3") 575392f7a3SLiteSpeed Tech SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -Werror") 58db8ac9eeSDmitri Tikhonov IF(CMAKE_C_COMPILER MATCHES "clang" AND 5903e6b668SDmitri Tikhonov NOT "$ENV{TRAVIS}" MATCHES "^true$" AND 6003e6b668SDmitri Tikhonov NOT "$ENV{EXTRA_CFLAGS}" MATCHES "-fsanitize") 6150aadb33SDmitri Tikhonov SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -fsanitize=address") 62d6937ddcSinitlife SET(LIBS ${LIBS} -fsanitize=address) 6350aadb33SDmitri Tikhonov ENDIF() 645392f7a3SLiteSpeed Tech # Uncomment to enable cleartext protocol mode (no crypto): 655392f7a3SLiteSpeed Tech #SET (MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -DLSQUIC_ENABLE_HANDSHAKE_DISABLE=1") 6650aadb33SDmitri TikhonovELSE() 6750aadb33SDmitri Tikhonov SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -O3 -g0") 6850aadb33SDmitri Tikhonov # Comment out the following line to compile out debug messages: 6950aadb33SDmitri Tikhonov #SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -DLSQUIC_LOWEST_LOG_LEVEL=LSQ_LOG_INFO") 7050aadb33SDmitri TikhonovENDIF() 7150aadb33SDmitri Tikhonov 7267b0dc15SDmitri TikhonovIF(LSQUIC_PROFILE EQUAL 1) 7367b0dc15SDmitri Tikhonov SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -g -pg") 7467b0dc15SDmitri TikhonovENDIF() 7567b0dc15SDmitri Tikhonov 7616a9b66aSDmitri TikhonovIF(LSQUIC_COVERAGE EQUAL 1) 7716a9b66aSDmitri Tikhonov SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -fprofile-arcs -ftest-coverage") 7816a9b66aSDmitri TikhonovENDIF() 7916a9b66aSDmitri Tikhonov 8050aadb33SDmitri TikhonovIF(MY_CMAKE_FLAGS MATCHES "fsanitize=address") 8150aadb33SDmitri Tikhonov MESSAGE(STATUS "AddressSanitizer is ON") 8250aadb33SDmitri TikhonovELSE() 8350aadb33SDmitri Tikhonov MESSAGE(STATUS "AddressSanitizer is OFF") 8450aadb33SDmitri TikhonovENDIF() 8550aadb33SDmitri Tikhonov 86461e84d8SAmol Deshpande#MSVC 87461e84d8SAmol DeshpandeELSE() 882d296031SDmitri TikhonovSET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} /wd4214") # nonstandard extension used: bit field types other than int 89461e84d8SAmol DeshpandeSET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -W4 -WX -Zi -DWIN32_LEAN_AND_MEAN -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -I${CMAKE_CURRENT_SOURCE_DIR}/wincompat") 901e75f938SDmitri TikhonovIF(CMAKE_BUILD_TYPE STREQUAL "Debug") 91b5d685fcSBob Perper SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -Od") 92461e84d8SAmol Deshpande #SET (MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -DFIU_ENABLE=1") 93ccd74161SDmitri Tikhonov #SET(LIBS ${LIBS} fiu) 94461e84d8SAmol DeshpandeELSE() 95b5d685fcSBob Perper SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -Ox") 96461e84d8SAmol Deshpande # Comment out the following line to compile out debug messages: 97461e84d8SAmol Deshpande #SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -DLSQUIC_LOWEST_LOG_LEVEL=LSQ_LOG_INFO") 98461e84d8SAmol DeshpandeENDIF() 99461e84d8SAmol Deshpande 100461e84d8SAmol DeshpandeENDIF() #MSVC 101461e84d8SAmol Deshpande 10250aadb33SDmitri Tikhonovset(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MY_CMAKE_FLAGS} $ENV{EXTRA_CFLAGS}") 10350aadb33SDmitri Tikhonov 10450aadb33SDmitri TikhonovMESSAGE(STATUS "Compiler flags: ${CMAKE_C_FLAGS}") 10550aadb33SDmitri Tikhonov 1068ca33e0eSDmitri TikhonovIF (NOT DEFINED BORINGSSL_INCLUDE AND DEFINED BORINGSSL_DIR) 1078ca33e0eSDmitri Tikhonov FIND_PATH(BORINGSSL_INCLUDE NAMES openssl/ssl.h 1088ca33e0eSDmitri Tikhonov PATHS ${BORINGSSL_DIR}/include 1098ca33e0eSDmitri Tikhonov NO_DEFAULT_PATH) 1108ca33e0eSDmitri TikhonovENDIF() 111b1af35d6SDmitri Tikhonov# This must be done before adding other include directories to take 112b1af35d6SDmitri Tikhonov# precedence over header files from other SSL installs. 1138ca33e0eSDmitri Tikhonov 1148ca33e0eSDmitri TikhonovIF (BORINGSSL_INCLUDE) 1158ca33e0eSDmitri Tikhonov MESSAGE(STATUS "BoringSSL include directory ${BORINGSSL_INCLUDE}") 1168ca33e0eSDmitri Tikhonov INCLUDE_DIRECTORIES(${BORINGSSL_INCLUDE}) 117b1af35d6SDmitri TikhonovELSE() 118b1af35d6SDmitri Tikhonov MESSAGE(FATAL_ERROR "BoringSSL headers not found") 119e0197994SDmitri TikhonovENDIF() 12050aadb33SDmitri Tikhonov 1218ca33e0eSDmitri TikhonovIF (NOT DEFINED BORINGSSL_LIB AND DEFINED BORINGSSL_DIR) 1228ca33e0eSDmitri Tikhonov FOREACH(LIB_NAME ssl crypto decrepit) 1238ca33e0eSDmitri Tikhonov IF (CMAKE_SYSTEM_NAME STREQUAL Windows) 1248ca33e0eSDmitri Tikhonov FIND_LIBRARY(BORINGSSL_LIB_${LIB_NAME} 1258ca33e0eSDmitri Tikhonov NAMES ${LIB_NAME} 1268ca33e0eSDmitri Tikhonov PATHS ${BORINGSSL_DIR}/${LIB_NAME} 1278ca33e0eSDmitri Tikhonov PATH_SUFFIXES Debug Release MinSizeRel RelWithDebInfo 1288ca33e0eSDmitri Tikhonov NO_DEFAULT_PATH) 1298ca33e0eSDmitri Tikhonov ELSE() 1308ca33e0eSDmitri Tikhonov FIND_LIBRARY(BORINGSSL_LIB_${LIB_NAME} 1318ca33e0eSDmitri Tikhonov NAMES lib${LIB_NAME}.a 1328ca33e0eSDmitri Tikhonov PATHS ${BORINGSSL_DIR}/${LIB_NAME} 1338ca33e0eSDmitri Tikhonov NO_DEFAULT_PATH) 1348ca33e0eSDmitri Tikhonov ENDIF() 1358ca33e0eSDmitri Tikhonov IF(BORINGSSL_LIB_${LIB_NAME}) 1368ca33e0eSDmitri Tikhonov MESSAGE(STATUS "Found ${LIB_NAME} library: ${BORINGSSL_LIB_${LIB_NAME}}") 1378ca33e0eSDmitri Tikhonov ELSE() 1388ca33e0eSDmitri Tikhonov MESSAGE(STATUS "${LIB_NAME} library not found") 1398ca33e0eSDmitri Tikhonov ENDIF() 1408ca33e0eSDmitri Tikhonov ENDFOREACH() 1418ca33e0eSDmitri Tikhonov 1428ca33e0eSDmitri TikhonovELSE() 1438ca33e0eSDmitri Tikhonov 1448ca33e0eSDmitri Tikhonov 1458ca33e0eSDmitri Tikhonov FOREACH(LIB_NAME ssl crypto decrepit) 1468ca33e0eSDmitri Tikhonov IF (CMAKE_SYSTEM_NAME STREQUAL Windows) 1478ca33e0eSDmitri Tikhonov FIND_LIBRARY(BORINGSSL_LIB_${LIB_NAME} 1488ca33e0eSDmitri Tikhonov NAMES ${LIB_NAME} 1498ca33e0eSDmitri Tikhonov PATHS ${BORINGSSL_LIB} 1508ca33e0eSDmitri Tikhonov PATH_SUFFIXES Debug Release MinSizeRel RelWithDebInfo 1518ca33e0eSDmitri Tikhonov NO_DEFAULT_PATH) 1528ca33e0eSDmitri Tikhonov ELSE() 1538ca33e0eSDmitri Tikhonov FIND_LIBRARY(BORINGSSL_LIB_${LIB_NAME} 1548ca33e0eSDmitri Tikhonov NAMES lib${LIB_NAME}.a 1558ca33e0eSDmitri Tikhonov PATHS ${BORINGSSL_LIB} 15681558c3fSRahul Jadhav PATH_SUFFIXES ${LIB_NAME} 1578ca33e0eSDmitri Tikhonov NO_DEFAULT_PATH) 1588ca33e0eSDmitri Tikhonov ENDIF() 1598ca33e0eSDmitri Tikhonov IF(BORINGSSL_LIB_${LIB_NAME}) 1608ca33e0eSDmitri Tikhonov MESSAGE(STATUS "Found ${BORINGSSL_LIB} library: ${BORINGSSL_LIB_${LIB_NAME}}") 1618ca33e0eSDmitri Tikhonov ELSE() 1628ca33e0eSDmitri Tikhonov MESSAGE(STATUS "${BORINGSSL_LIB} library not found") 1638ca33e0eSDmitri Tikhonov ENDIF() 1648ca33e0eSDmitri Tikhonov ENDFOREACH() 1658ca33e0eSDmitri Tikhonov#endif 166461e84d8SAmol Deshpande 1678ca33e0eSDmitri TikhonovENDIF() 1688ca33e0eSDmitri Tikhonov 1698ca33e0eSDmitri TikhonovSET(CMAKE_INCLUDE_CURRENT_DIR ON) 17083506617SDmitri TikhonovINCLUDE_DIRECTORIES(include) 171b1af35d6SDmitri TikhonovIF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "Darwin") 17250aadb33SDmitri Tikhonov # Find libevent on FreeBSD: 1738ca33e0eSDmitri Tikhonov include_directories( /usr/local/include ) 1748ca33e0eSDmitri Tikhonov link_directories( /usr/local/lib ) 175b1af35d6SDmitri TikhonovENDIF() 176b1af35d6SDmitri Tikhonov 177b1af35d6SDmitri Tikhonov# Find zlib and libevent header files and library files 178b1af35d6SDmitri Tikhonov# TODO: libevent is not strictly necessary to build the library. 179b1af35d6SDmitri TikhonovFIND_PATH(ZLIB_INCLUDE_DIR NAMES zlib.h) 180b1af35d6SDmitri TikhonovIF (ZLIB_INCLUDE_DIR) 181b1af35d6SDmitri Tikhonov INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) 182b1af35d6SDmitri TikhonovELSE() 183b1af35d6SDmitri Tikhonov MESSAGE(FATAL_ERROR "zlib.h was not found") 184b1af35d6SDmitri TikhonovENDIF() 185b1af35d6SDmitri TikhonovIF (CMAKE_SYSTEM_NAME STREQUAL Windows) 186b1af35d6SDmitri Tikhonov FIND_LIBRARY(ZLIB_LIB zlib) 187b1af35d6SDmitri TikhonovELSEIF(CMAKE_SYSTEM_NAME STREQUAL Darwin) 188b1af35d6SDmitri Tikhonov # XXX somehow FIND_LIBRARY() does not find zlib on Travis? 189b1af35d6SDmitri Tikhonov SET(ZLIB_LIB z) 190b1af35d6SDmitri TikhonovELSE() 191b1af35d6SDmitri Tikhonov FIND_LIBRARY(ZLIB_LIB libz.a) 192b1af35d6SDmitri TikhonovENDIF() 193b1af35d6SDmitri TikhonovIF(ZLIB_LIB) 194b1af35d6SDmitri Tikhonov MESSAGE(STATUS "Found zlib: ${ZLIB_LIB}") 195b1af35d6SDmitri TikhonovELSE() 196b1af35d6SDmitri Tikhonov MESSAGE(STATUS "zlib not found") 197b1af35d6SDmitri TikhonovENDIF() 1989a690580SDmitri Tikhonov 1999a690580SDmitri TikhonovIF (LSQUIC_BIN) 200b1af35d6SDmitri TikhonovFIND_PATH(EVENT_INCLUDE_DIR NAMES event2/event.h) 201b1af35d6SDmitri TikhonovIF (EVENT_INCLUDE_DIR) 202b1af35d6SDmitri Tikhonov INCLUDE_DIRECTORIES(${EVENT_INCLUDE_DIR}) 203b1af35d6SDmitri TikhonovELSE() 204b1af35d6SDmitri Tikhonov MESSAGE(FATAL_ERROR "event2/event.h was not found") 205b1af35d6SDmitri TikhonovENDIF() 206b1af35d6SDmitri TikhonovIF (CMAKE_SYSTEM_NAME STREQUAL Windows) 207b1af35d6SDmitri Tikhonov FIND_LIBRARY(EVENT_LIB event) 208b1af35d6SDmitri TikhonovELSE() 209747be414SDmitri Tikhonov FIND_LIBRARY(EVENT_LIB libevent.a) 210747be414SDmitri Tikhonov IF(NOT EVENT_LIB) 211747be414SDmitri Tikhonov FIND_LIBRARY(EVENT_LIB libevent.so) 212747be414SDmitri Tikhonov ENDIF() 213b1af35d6SDmitri TikhonovENDIF() 214b1af35d6SDmitri TikhonovIF(EVENT_LIB) 215b1af35d6SDmitri Tikhonov MESSAGE(STATUS "Found event: ${EVENT_LIB}") 216b1af35d6SDmitri TikhonovELSE() 217b1af35d6SDmitri Tikhonov MESSAGE(STATUS "libevent not found") 21850aadb33SDmitri TikhonovENDIF() 21950aadb33SDmitri Tikhonov 2209a690580SDmitri Tikhonovadd_executable(http_server bin/http_server.c bin/prog.c bin/test_common.c bin/test_cert.c) 2219a690580SDmitri Tikhonovadd_executable(md5_server bin/md5_server.c bin/prog.c bin/test_common.c bin/test_cert.c) 2229a690580SDmitri Tikhonovadd_executable(md5_client bin/md5_client.c bin/prog.c bin/test_common.c bin/test_cert.c) 2239a690580SDmitri Tikhonovadd_executable(echo_server bin/echo_server.c bin/prog.c bin/test_common.c bin/test_cert.c) 2249a690580SDmitri Tikhonovadd_executable(echo_client bin/echo_client.c bin/prog.c bin/test_common.c bin/test_cert.c) 2255392f7a3SLiteSpeed Tech 2268ca33e0eSDmitri Tikhonov 2278ca33e0eSDmitri TikhonovSET(LIBS lsquic ${EVENT_LIB} ${BORINGSSL_LIB_ssl} ${BORINGSSL_LIB_crypto} ${ZLIB_LIB} ${LIBS}) 228b93f59beSBob Perper 22946a5b669SDmitri TikhonovIF (NOT MSVC) 2305392f7a3SLiteSpeed Tech 231c51ce338SDmitri Tikhonovadd_executable(http_client 2329a690580SDmitri Tikhonov bin/http_client.c 2339a690580SDmitri Tikhonov bin/prog.c 2349a690580SDmitri Tikhonov bin/test_common.c 2359a690580SDmitri Tikhonov bin/test_cert.c 236c51ce338SDmitri Tikhonov) 2378ca33e0eSDmitri TikhonovLIST(APPEND LIBS pthread m) 23850aadb33SDmitri Tikhonov 2395d77f141SAmol Deshpande#MSVC 240461e84d8SAmol DeshpandeELSE() 2415392f7a3SLiteSpeed Tech 242461e84d8SAmol Deshpandeadd_executable(http_client 2439a690580SDmitri Tikhonov bin/http_client.c 2449a690580SDmitri Tikhonov bin/prog.c 2459a690580SDmitri Tikhonov bin/test_common.c 246461e84d8SAmol Deshpande wincompat/getopt.c 247461e84d8SAmol Deshpande wincompat/getopt1.c 248461e84d8SAmol Deshpande) 2498ca33e0eSDmitri TikhonovLIST(APPEND LIBS ws2_32) 250461e84d8SAmol Deshpande 251461e84d8SAmol DeshpandeENDIF() 252461e84d8SAmol Deshpande 2538ca33e0eSDmitri TikhonovTARGET_LINK_LIBRARIES(http_client ${LIBS}) 2545392f7a3SLiteSpeed TechTARGET_LINK_LIBRARIES(http_server ${LIBS}) 2550adf085aSDmitri TikhonovTARGET_LINK_LIBRARIES(md5_server ${LIBS}) 2560adf085aSDmitri TikhonovTARGET_LINK_LIBRARIES(md5_client ${LIBS}) 2570adf085aSDmitri TikhonovTARGET_LINK_LIBRARIES(echo_server ${LIBS}) 2580adf085aSDmitri TikhonovTARGET_LINK_LIBRARIES(echo_client ${LIBS}) 25950aadb33SDmitri Tikhonov 2609a690580SDmitri Tikhonovadd_subdirectory(bin) 2619a690580SDmitri TikhonovENDIF() # LSQUIC_BIN 26250aadb33SDmitri Tikhonov 26321c6983aSRahul Jadhavadd_subdirectory(src) 26421c6983aSRahul Jadhav 2659a690580SDmitri TikhonovIF(LSQUIC_TESTS AND CMAKE_BUILD_TYPE STREQUAL "Debug") 2667fbe101bSDmitri Tikhonov # Our test framework relies on assertions, only compile if assertions are 2677fbe101bSDmitri Tikhonov # enabled. 2687fbe101bSDmitri Tikhonov # 2697fbe101bSDmitri Tikhonov enable_testing() 2709a690580SDmitri Tikhonov add_subdirectory(tests) 2717fbe101bSDmitri TikhonovENDIF() 2727fbe101bSDmitri Tikhonov 273feca77f5SDmitri Tikhonov 2740bd32030SDmitri TikhonovFIND_PROGRAM(SPHINX NAMES sphinx-build) 2750bd32030SDmitri TikhonovIF(SPHINX) 2760bd32030SDmitri Tikhonov ADD_CUSTOM_TARGET(docs 2770bd32030SDmitri Tikhonov ${SPHINX} -b html 2780bd32030SDmitri Tikhonov docs 2790bd32030SDmitri Tikhonov docs/_build 2800bd32030SDmitri Tikhonov ) 2810bd32030SDmitri TikhonovELSE() 2820bd32030SDmitri Tikhonov MESSAGE(STATUS "sphinx-build not found: docs won't be made") 2830bd32030SDmitri TikhonovENDIF() 284