From ded16fbe8d5c146ed413c8682fc67a8b8e40a3ce Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Tue, 31 Jan 2023 04:55:12 +0800 Subject: [PATCH] Fix CMakeLists for MacPorts diff --git a/CMakeLists.txt b/CMakeLists.txt index 7cb4f6dc..9198c575 100644 --- CMakeLists.txt +++ CMakeLists.txt @@ -576,64 +576,12 @@ ## should be sent upstream. ## Restbed is therefore compiled by Android toolchain preparation script target_link_libraries(${PROJECT_NAME} PRIVATE restbed) - elseif(NOT WIN32 AND EXISTS "${RESTBED_DEVEL_DIR}/CMakeLists.txt") - ## On Windows, skip the local submodule: recent restbed HEAD requires - ## system ASIO (not available by default on MSYS2/MinGW). Fall through - ## to FetchContent which downloads restbed 4.8 with bundled ASIO. - message( STATUS - "Restbed submodule found at ${RESTBED_DEVEL_DIR} using it" ) - add_subdirectory( - ${RESTBED_DEVEL_DIR} - ${CMAKE_BINARY_DIR}/restbed - EXCLUDE_FROM_ALL ) - # EXCLUDE_FROM_ALL prevent executing install directives from included - # dependencies see https://stackoverflow.com/a/64900982 - - set(RESTBED_TARGET restbed-static) - if(TARGET restbed-shared AND BUILD_SHARED_LIBS) - set(RESTBED_TARGET restbed-shared) - endif() - - target_include_directories( - ${PROJECT_NAME} PUBLIC "${RESTBED_DEVEL_DIR}/source/" ) - target_link_libraries(${PROJECT_NAME} PRIVATE ${RESTBED_TARGET}) else() - message( WARNING - "FetchContent restbed, will be installed if you run make install") - FetchContent_Declare( - restbed - GIT_REPOSITORY "https://github.com/Corvusoft/restbed.git" - GIT_TAG "4.8" - GIT_SUBMODULES dependency/asio dependency/catch - GIT_SHALLOW TRUE - GIT_PROGRESS TRUE - TIMEOUT 10 - # PATCH_COMMAND applies hotfixes to restbed before building: - # 1. Removes /wd4251 (MSVC-specific flag) that breaks GCC/Clang builds. - # 2. Bumps CMake minimum version to 3.5.0 to suppress deprecation warnings in CMake >= 3.27. - PATCH_COMMAND sed -i -e "s|/wd4251||g" -e "s|VERSION 3.1.0|VERSION 3.5.0|g" CMakeLists.txt - ) - FetchContent_MakeAvailable(restbed) - - set(RESTBED_TARGET restbed-static) - if(TARGET restbed-shared AND BUILD_SHARED_LIBS) - set(RESTBED_TARGET restbed-shared) - endif() - target_include_directories( - ${PROJECT_NAME} PUBLIC ${restbed_SOURCE_DIR}/source/ ) - target_link_libraries(${PROJECT_NAME} PRIVATE ${RESTBED_TARGET}) - if(WIN32) - if(TARGET restbed-static) - target_link_libraries(restbed-static PUBLIC ws2_32 winmm iphlpapi mswsock) - endif() - if(TARGET restbed-shared) - target_link_libraries(restbed-shared PUBLIC ws2_32 winmm iphlpapi mswsock) - endif() - endif() + ${PROJECT_NAME} PUBLIC @PREFIX@/include/restbed/ ) + target_link_libraries(${PROJECT_NAME} PUBLIC restbed) endif() - target_compile_definitions(${PROJECT_NAME} PUBLIC RS_JSONAPI) endif(RS_JSON_API)