Fix encfs build with BUILD_SHARED_LIBS=1 (#463)

* Fix build against tinyxml2 with BUILD_SHARED_LIBS=1
* Force building static easyloggingpp till upstream adds shared support
This commit is contained in:
Vlad Glagolev 2018-01-28 15:23:23 -05:00 committed by rfjakob
parent 1f6e94704c
commit 5dca65946a

View File

@ -206,15 +206,16 @@ if (USE_INTERNAL_TINYXML)
if (BUILD_SHARED_LIBS) if (BUILD_SHARED_LIBS)
set(BUILD_STATIC_LIBS OFF CACHE BOOL "build static libs") set(BUILD_STATIC_LIBS OFF CACHE BOOL "build static libs")
set(BUILD_SHARED_LIBS ON CACHE BOOL "build shared libs") set(BUILD_SHARED_LIBS ON CACHE BOOL "build shared libs")
set(TINYXML_LIBRARIES tinyxml2)
else () else ()
set(BUILD_STATIC_LIBS ON CACHE BOOL "build static libs") set(BUILD_STATIC_LIBS ON CACHE BOOL "build static libs")
set(BUILD_SHARED_LIBS OFF CACHE BOOL "build shared libs") set(BUILD_SHARED_LIBS OFF CACHE BOOL "build shared libs")
set(TINYXML_LIBRARIES tinyxml2_static)
endif () endif ()
set(BUILD_TESTS OFF CACHE BOOL "build tests") set(BUILD_TESTS OFF CACHE BOOL "build tests")
add_subdirectory(${TINYXML_DIR} EXCLUDE_FROM_ALL) add_subdirectory(${TINYXML_DIR} EXCLUDE_FROM_ALL)
include_directories(SYSTEM ${CMAKE_CURRENT_LIST_DIR}/${TINYXML_DIR}) include_directories(SYSTEM ${CMAKE_CURRENT_LIST_DIR}/${TINYXML_DIR})
link_directories(${CMAKE_BINARY_DIR}/${TINYXML_DIR}) link_directories(${CMAKE_BINARY_DIR}/${TINYXML_DIR})
set(TINYXML_LIBRARIES tinyxml2_static)
else () else ()
find_package (TinyXML REQUIRED) find_package (TinyXML REQUIRED)
include_directories (SYSTEM ${TINYXML_INCLUDE_DIR}) include_directories (SYSTEM ${TINYXML_INCLUDE_DIR})
@ -223,11 +224,7 @@ endif ()
if (USE_INTERNAL_EASYLOGGING) if (USE_INTERNAL_EASYLOGGING)
message("-- Using vendored Easylogging++") message("-- Using vendored Easylogging++")
set(EASYLOGGING_DIR vendor/github.com/muflihun/easyloggingpp) set(EASYLOGGING_DIR vendor/github.com/muflihun/easyloggingpp)
if (BUILD_SHARED_LIBS) set(build_static_lib ON CACHE BOOL "build static libs")
set(build_static_lib OFF CACHE BOOL "build static libs")
else ()
set(build_static_lib ON CACHE BOOL "build static libs")
endif ()
add_subdirectory(${EASYLOGGING_DIR} EXCLUDE_FROM_ALL) add_subdirectory(${EASYLOGGING_DIR} EXCLUDE_FROM_ALL)
include_directories(SYSTEM ${CMAKE_CURRENT_LIST_DIR}/${EASYLOGGING_DIR}/src) include_directories(SYSTEM ${CMAKE_CURRENT_LIST_DIR}/${EASYLOGGING_DIR}/src)
link_directories(${CMAKE_BINARY_DIR}/${EASYLOGGING_DIR}) link_directories(${CMAKE_BINARY_DIR}/${EASYLOGGING_DIR})