vcpkg/ports/folly/fix-cmakelists.patch
Robert Schumacher 861d7976d6 [folly] Add a dependency on PYTHON3 (the tool)
Rebase patch list to be compatible with previous portfile versions.
2017-05-09 21:30:26 -07:00

90 lines
3.9 KiB
Diff

diff --git a/CMake/folly-deps.cmake b/CMake/folly-deps.cmake
index 211c6fbf..988225a2 100755
--- a/CMake/folly-deps.cmake
+++ b/CMake/folly-deps.cmake
@@ -11,8 +11,8 @@ find_package(Boost 1.55.0 MODULE
REQUIRED
)
find_package(DoubleConversion MODULE REQUIRED)
-find_package(GFlags MODULE REQUIRED)
-find_package(GLog MODULE REQUIRED)
+find_package(gflags CONFIG REQUIRED)
+find_package(glog CONFIG REQUIRED)
find_package(LibEvent MODULE REQUIRED)
find_package(OpenSSL MODULE REQUIRED)
find_package(PThread MODULE)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 38886d65..4c796eac 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,15 +1,8 @@
cmake_minimum_required(VERSION 3.4.0 FATAL_ERROR)
-# Unfortunately, CMake doesn't easily provide us a way to merge static
-# libraries, which is what we want to do to generate the main folly library, so
-# we do a bit of a workaround here to inject a property into the generated
-# project files that will only get enabled for the folly target. Ugly, but
-# the alternatives are far, far worse.
if ("${CMAKE_GENERATOR}" MATCHES "Visual Studio 15( 2017)? Win64")
- set(CMAKE_GENERATOR_TOOLSET "v141</PlatformToolset></PropertyGroup><ItemDefinitionGroup Condition=\"'$(ProjectName)'=='folly'\"><ProjectReference><LinkLibraryDependencies>true</LinkLibraryDependencies></ProjectReference></ItemDefinitionGroup><PropertyGroup><PlatformToolset>v141")
set(MSVC_IS_2017 ON)
elseif ("${CMAKE_GENERATOR}" STREQUAL "Visual Studio 14 2015 Win64")
- set(CMAKE_GENERATOR_TOOLSET "v140</PlatformToolset></PropertyGroup><ItemDefinitionGroup Condition=\"'$(ProjectName)'=='folly'\"><ProjectReference><LinkLibraryDependencies>true</LinkLibraryDependencies></ProjectReference></ItemDefinitionGroup><PropertyGroup><PlatformToolset>v140")
set(MSVC_IS_2017 OFF)
else()
message(FATAL_ERROR "This build script only supports building Folly on 64-bit Windows with Visual Studio 2015 or Visual Studio 2017.")
@@ -122,7 +115,8 @@ add_library(folly_base STATIC
)
auto_source_group(folly ${FOLLY_DIR} ${files} ${hfiles})
apply_folly_compile_options_to_target(folly_base)
-target_include_directories(folly_base PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
+target_include_directories(folly_base PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
# Add the generated files to the correct source group.
source_group("folly" FILES ${CMAKE_CURRENT_BINARY_DIR}/folly/folly-config.h)
source_group("folly\\build" FILES
@@ -133,10 +127,9 @@ source_group("folly\\build" FILES
)
target_include_directories(folly_base
- PUBLIC
+ PRIVATE
${DOUBLE_CONVERSION_INCLUDE_DIR}
${LIBGFLAGS_INCLUDE_DIR}
- ${LIBGLOG_INCLUDE_DIR}
${LIBEVENT_INCLUDE_DIR}
)
target_link_libraries(folly_base
@@ -151,13 +144,13 @@ target_link_libraries(folly_base
${DOUBLE_CONVERSION_LIBRARY}
${LIBEVENT_LIB}
${LIBGFLAGS_LIBRARY}
- ${LIBGLOG_LIBRARY}
+ glog::glog
OpenSSL::SSL
OpenSSL::Crypto
Ws2_32.lib
)
if (FOLLY_HAVE_PTHREAD)
- target_include_directories(folly_base PUBLIC ${LIBPTHREAD_INCLUDE_DIRS})
+ target_include_directories(folly_base PRIVATE ${LIBPTHREAD_INCLUDE_DIRS})
target_link_libraries(folly_base PUBLIC ${LIBPTHREAD_LIBRARIES})
endif()
@@ -199,13 +192,10 @@ add_library(folly ${CMAKE_CURRENT_BINARY_DIR}/folly_dep.cpp)
apply_folly_compile_options_to_target(folly)
source_group("" FILES ${CMAKE_CURRENT_BINARY_DIR}/folly_dep.cpp)
-# Rather than list the dependencies in two places, we apply them directly on
-# the folly_base target and then copy them over to the folly target.
-get_target_property(FOLLY_LINK_LIBRARIES folly_base INTERFACE_LINK_LIBRARIES)
-target_link_libraries(folly PUBLIC ${FOLLY_LINK_LIBRARIES})
+target_link_libraries(folly PUBLIC folly_base)
target_include_directories(folly PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
-install(TARGETS folly
+install(TARGETS folly folly_base
EXPORT folly
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib