vcpkg/ports/restbed/cmake.patch
Tom Henoch de7bc03245 Initial restbed port (#4232)
* Restbed port

* [restbed] Disable tests to simplify build. Only build one flavor.
2018-10-16 01:59:33 -07:00

60 lines
2.5 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b66143e..85c5315 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,7 +42,9 @@ endif ( )
set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake" )
find_package( asio REQUIRED )
+if(NOT DISABLE_TESTS)
find_package( catch REQUIRED )
+endif()
if ( BUILD_SSL )
find_package( openssl REQUIRED )
endif ( )
@@ -54,6 +56,7 @@ include_directories( ${INCLUDE_DIR} SYSTEM ${asio_INCLUDE} ${kashmir_INCLUDE} ${
#
file( GLOB_RECURSE MANIFEST "${SOURCE_DIR}/*.cpp" )
+if(NOT BUILD_SHARED_LIBS)
set( STATIC_LIBRARY_NAME "${PROJECT_NAME}-static" )
add_library( ${STATIC_LIBRARY_NAME} STATIC ${MANIFEST} )
set_property( TARGET ${STATIC_LIBRARY_NAME} PROPERTY CXX_STANDARD 11 )
@@ -64,7 +67,9 @@ if ( BUILD_SSL )
else ( )
target_link_libraries( ${STATIC_LIBRARY_NAME} )
endif ( )
+endif()
+if(BUILD_SHARED_LIBS)
set( SHARED_LIBRARY_NAME "${PROJECT_NAME}-shared" )
add_library( ${SHARED_LIBRARY_NAME} SHARED ${MANIFEST} )
set_property( TARGET ${SHARED_LIBRARY_NAME} PROPERTY CXX_STANDARD 11 )
@@ -76,12 +81,15 @@ if ( BUILD_SSL )
else ( )
target_link_libraries( ${SHARED_LIBRARY_NAME} )
endif ( )
+endif()
+if(NOT DISABLE_TESTS)
enable_testing( )
add_subdirectory( "${PROJECT_SOURCE_DIR}/test/unit" )
add_subdirectory( "${PROJECT_SOURCE_DIR}/test/feature" )
add_subdirectory( "${PROJECT_SOURCE_DIR}/test/regression" )
add_subdirectory( "${PROJECT_SOURCE_DIR}/test/integration" )
+endif()
#
# Install
@@ -90,5 +98,8 @@ file( GLOB ARTIFACTS "${SOURCE_DIR}/*.hpp" )
install( FILES "${INCLUDE_DIR}/${PROJECT_NAME}" DESTINATION "${CMAKE_INSTALL_PREFIX}/include" )
install( FILES ${ARTIFACTS} DESTINATION "${CMAKE_INSTALL_PREFIX}/include/corvusoft/${PROJECT_NAME}" )
-install( TARGETS ${STATIC_LIBRARY_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library )
-install( TARGETS ${SHARED_LIBRARY_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library )
+if(NOT BUILD_SHARED_LIBS)
+install( TARGETS ${STATIC_LIBRARY_NAME} RUNTIME DESTINATION bin LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library )
+else()
+install( TARGETS ${SHARED_LIBRARY_NAME} RUNTIME DESTINATION bin LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library )
+endif()