Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
7e99d5c3
Commit
7e99d5c3
authored
Apr 16, 2020
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move repetitive CMake steps into functions
parent
1c0b810e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
161 additions
and
236 deletions
+161
-236
CMakeLists.txt
CMakeLists.txt
+70
-28
libcaf_core/CMakeLists.txt
libcaf_core/CMakeLists.txt
+40
-83
libcaf_io/CMakeLists.txt
libcaf_io/CMakeLists.txt
+26
-61
libcaf_openssl/CMakeLists.txt
libcaf_openssl/CMakeLists.txt
+25
-64
No files found.
CMakeLists.txt
View file @
7e99d5c3
...
...
@@ -66,31 +66,45 @@ if(NOT CAF_LOG_LEVEL IN_LIST CAF_VALID_LOG_LEVELS)
message
(
FATAL_ERROR
"Invalid log level:
\"
${
CAF_LOG_LEVEL
}
\"
"
)
endif
()
# -- compiler setup ------------------------------------------------------------
if
(
MSVC
)
# Disable 4275 and 4251 (warnings regarding C++ classes at ABI boundaries).
add_compile_options
(
/wd4275 /wd4251
)
if
(
CAF_SANITIZERS
)
message
(
FATAL_ERROR
"Sanitizer builds are currently not supported on MSVC"
)
endif
()
elseif
(
CMAKE_CXX_COMPILER_ID MATCHES
"Clang"
OR CMAKE_CXX_COMPILER_ID MATCHES
"GNU"
)
# Flags for both compilers.
add_compile_options
(
-ftemplate-depth=512 -ftemplate-backtrace-limit=0
-Wall -Wextra -pedantic
)
if
(
CMAKE_CXX_COMPILER_ID MATCHES
"Clang"
)
# Flags for Clang only.
add_compile_options
(
-Wdocumentation
)
else
()
# Flags for GCC only.
add_compile_options
(
-Wno-missing-field-initializers
)
endif
()
if
(
MSVC AND CAF_SANITIZERS
)
message
(
FATAL_ERROR
"Sanitizer builds are currently not supported on MSVC"
)
endif
()
if
(
CAF_SANITIZERS
)
add_compile_options
(
-fsanitize=
${
CAF_SANITIZERS
}
-fno-omit-frame-pointer
)
endif
()
# -- compiler setup ------------------------------------------------------------
function
(
caf_set_default_properties
)
foreach
(
target
${
ARGN
}
)
if
(
MSVC
)
# Disable 4275 and 4251 (warnings regarding C++ classes at ABI boundaries).
target_compile_options
(
${
target
}
PRIVATE /wd4275 /wd4251
)
elseif
(
CMAKE_CXX_COMPILER_ID MATCHES
"Clang"
OR CMAKE_CXX_COMPILER_ID MATCHES
"GNU"
)
# Flags for both compilers.
target_compile_options
(
${
target
}
PRIVATE -Wall -Wextra -pedantic
-ftemplate-depth=512 -ftemplate-backtrace-limit=0
)
if
(
CMAKE_CXX_COMPILER_ID MATCHES
"Clang"
)
# Flags for Clang only.
target_compile_options
(
${
target
}
PRIVATE -Wdocumentation
)
else
()
# Flags for GCC only.
target_compile_options
(
${
target
}
PRIVATE
-Wno-missing-field-initializers
)
endif
()
endif
()
if
(
CAF_SANITIZERS
)
target_compile_options
(
${
target
}
PRIVATE
-fsanitize=
${
CAF_SANITIZERS
}
-fno-omit-frame-pointer
)
target_link_libraries
(
${
target
}
PRIVATE
-fsanitize=
${
CAF_SANITIZERS
}
-fno-omit-frame-pointer
)
endif
()
# We always place headers in the same directories and need to find generated
# headers from the bin dir.
target_include_directories
(
${
target
}
PRIVATE
"
${
CMAKE_BINARY_DIR
}
"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
)
endforeach
()
endfunction
()
# -- unit testing setup / caf_add_test_suites function ------------------------
...
...
@@ -145,9 +159,7 @@ endif()
if
(
BUILD_SHARED_LIBS
)
set
(
CMAKE_CXX_VISIBILITY_PRESET hidden
)
set
(
CMAKE_VISIBILITY_INLINES_HIDDEN yes
)
if
(
POLICY CMP0063
)
cmake_policy
(
SET CMP0063 NEW
)
endif
()
cmake_policy
(
SET CMP0063 NEW
)
endif
()
# -- utility targets -----------------------------------------------------------
...
...
@@ -160,7 +172,7 @@ if(CAF_ENABLE_UTILITY_TARGETS)
add_custom_target
(
update-enum-strings
)
# adds a consistency check that verifies that `cpp_file` is still valid by
# re-generating the file and comparing it to the existing file
function
(
add_enum_consistency_check hpp_file cpp_file
)
function
(
caf_
add_enum_consistency_check hpp_file cpp_file
)
set
(
input
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
hpp_file
}
"
)
set
(
file_under_test
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
cpp_file
}
"
)
set
(
output
"
${
CMAKE_CURRENT_BINARY_DIR
}
/check/
${
cpp_file
}
"
)
...
...
@@ -187,7 +199,7 @@ if(CAF_ENABLE_UTILITY_TARGETS)
add_dependencies
(
update-enum-strings
"
${
target_name
}
-update"
)
endfunction
()
else
()
function
(
add_enum_consistency_check hpp_file cpp_file
)
function
(
caf_
add_enum_consistency_check hpp_file cpp_file
)
# nop
endfunction
()
endif
()
...
...
@@ -250,6 +262,36 @@ add_custom_command(TARGET uninstall
COMMAND
"
${
CMAKE_COMMAND
}
"
-P
"
${
CMAKE_CURRENT_BINARY_DIR
}
/cmake_uninstall.cmake"
)
# -- utility function for installing library targets ---------------------------
function
(
caf_export_and_install_lib component
)
add_library
(
CAF::
${
component
}
ALIAS libcaf_
${
component
}
)
string
(
TOUPPER
"CAF_
${
component
}
_EXPORT"
exportMacroName
)
target_include_directories
(
libcaf_
${
component
}
INTERFACE
$<BUILD_INTERFACE:
${
CMAKE_CURRENT_SOURCE_DIR
}
>
$<INSTALL_INTERFACE:include>
)
generate_export_header
(
libcaf_
${
component
}
EXPORT_MACRO_NAME
${
exportMacroName
}
EXPORT_FILE_NAME
"
${
CMAKE_BINARY_DIR
}
/caf/detail/
${
component
}
_export.hpp"
)
set_target_properties
(
libcaf_
${
component
}
PROPERTIES
EXPORT_NAME
${
component
}
SOVERSION
${
CAF_VERSION
}
VERSION
${
CAF_LIB_VERSION
}
OUTPUT_NAME caf_
${
component
}
)
install
(
FILES
"
${
CMAKE_BINARY_DIR
}
/caf/detail/
${
component
}
_export.hpp"
DESTINATION
"
${
CMAKE_INSTALL_INCLUDEDIR
}
/caf/detail"
)
install
(
TARGETS libcaf_
${
component
}
EXPORT CAFTargets
ARCHIVE DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
COMPONENT
${
component
}
RUNTIME DESTINATION
${
CMAKE_INSTALL_BINDIR
}
COMPONENT
${
component
}
LIBRARY DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
COMPONENT
${
component
}
)
install
(
DIRECTORY
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/caf"
DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
COMPONENT
${
component
}
FILES_MATCHING PATTERN
"*.hpp"
)
endfunction
()
# -- build all components the user asked for -----------------------------------
add_subdirectory
(
libcaf_core
)
...
...
libcaf_core/CMakeLists.txt
View file @
7e99d5c3
...
...
@@ -4,20 +4,41 @@ file(GLOB_RECURSE CAF_CORE_HEADERS "caf/*.hpp")
# -- add consistency checks for enum to_string implementations -----------------
add_enum_consistency_check
(
"caf/sec.hpp"
"src/sec_strings.cpp"
)
add_enum_consistency_check
(
"caf/pec.hpp"
"src/pec_strings.cpp"
)
add_enum_consistency_check
(
"caf/stream_priority.hpp"
"src/stream_priority_strings.cpp"
)
add_enum_consistency_check
(
"caf/exit_reason.hpp"
"src/exit_reason_strings.cpp"
)
add_enum_consistency_check
(
"caf/invoke_message_result.hpp"
"src/invoke_msg_result_strings.cpp"
)
add_enum_consistency_check
(
"caf/message_priority.hpp"
"src/message_priority_strings.cpp"
)
add_enum_consistency_check
(
"caf/intrusive/inbox_result.hpp"
"src/intrusive/inbox_result_strings.cpp"
)
add_enum_consistency_check
(
"caf/intrusive/task_result.hpp"
"src/intrusive/task_result_strings.cpp"
)
caf_add_enum_consistency_check
(
"caf/sec.hpp"
"src/sec_strings.cpp"
)
caf_add_enum_consistency_check
(
"caf/pec.hpp"
"src/pec_strings.cpp"
)
caf_add_enum_consistency_check
(
"caf/stream_priority.hpp"
"src/stream_priority_strings.cpp"
)
caf_add_enum_consistency_check
(
"caf/exit_reason.hpp"
"src/exit_reason_strings.cpp"
)
caf_add_enum_consistency_check
(
"caf/invoke_message_result.hpp"
"src/invoke_msg_result_strings.cpp"
)
caf_add_enum_consistency_check
(
"caf/message_priority.hpp"
"src/message_priority_strings.cpp"
)
caf_add_enum_consistency_check
(
"caf/intrusive/inbox_result.hpp"
"src/intrusive/inbox_result_strings.cpp"
)
caf_add_enum_consistency_check
(
"caf/intrusive/task_result.hpp"
"src/intrusive/task_result_strings.cpp"
)
# -- dependencies --------------------------------------------------------------
if
(
NOT TARGET Threads::Threads
)
find_package
(
Threads REQUIRED
)
endif
()
# -- utility function for setting default properties ---------------------------
function
(
caf_core_set_default_properties
)
foreach
(
target
${
ARGN
}
)
# Set global defaults and set EXPORTS flag.
caf_set_default_properties
(
${
target
}
)
target_compile_definitions
(
${
target
}
PRIVATE libcaf_core_EXPORTS
)
# Pull in public dependencies.
target_link_libraries
(
${
target
}
PUBLIC Threads::Threads
)
if
(
MSVC
)
target_link_libraries
(
${
target
}
PUBLIC iphlpapi
)
endif
()
endforeach
()
endfunction
()
# -- add library target --------------------------------------------------------
...
...
@@ -154,72 +175,14 @@ add_library(libcaf_core_obj OBJECT ${CAF_CORE_HEADERS}
src/uuid.cpp
)
target_include_directories
(
libcaf_core_obj PRIVATE
"
${
CMAKE_BINARY_DIR
}
"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
)
set_property
(
TARGET libcaf_core_obj PROPERTY POSITION_INDEPENDENT_CODE ON
)
add_library
(
libcaf_core
"
${
PROJECT_SOURCE_DIR
}
/cmake/dummy.cpp"
$<TARGET_OBJECTS:libcaf_core_obj>
)
target_include_directories
(
libcaf_core INTERFACE
$<BUILD_INTERFACE:
${
CMAKE_CURRENT_SOURCE_DIR
}
>
)
target_include_directories
(
libcaf_core INTERFACE
$<BUILD_INTERFACE:
${
CMAKE_BINARY_DIR
}
>
)
add_library
(
CAF::core ALIAS libcaf_core
)
# -- dependencies and compiler flags -------------------------------------------
caf_core_set_default_properties
(
libcaf_core_obj libcaf_core
)
if
(
BUILD_SHARED_LIBS AND NOT WIN32
)
target_compile_options
(
libcaf_core PRIVATE -fPIC
)
target_compile_options
(
libcaf_core_obj PRIVATE -fPIC
)
endif
()
if
(
NOT TARGET Threads::Threads
)
find_package
(
Threads REQUIRED
)
endif
()
target_link_libraries
(
libcaf_core PUBLIC Threads::Threads
)
if
(
MSVC
)
target_link_libraries
(
libcaf_core PUBLIC iphlpapi
)
endif
()
if
(
CAF_SANITIZERS
)
target_link_libraries
(
libcaf_core PUBLIC -fsanitize=
${
CAF_SANITIZERS
}
)
endif
()
# -- API exports ---------------------------------------------------------------
generate_export_header
(
libcaf_core
EXPORT_MACRO_NAME CAF_CORE_EXPORT
EXPORT_FILE_NAME
"
${
CMAKE_BINARY_DIR
}
/caf/detail/core_export.hpp"
STATIC_DEFINE CAF_STATIC_BUILD
)
target_compile_definitions
(
libcaf_core_obj PRIVATE libcaf_core_EXPORTS
)
set_target_properties
(
libcaf_core PROPERTIES
EXPORT_NAME core
SOVERSION
${
CAF_VERSION
}
VERSION
${
CAF_LIB_VERSION
}
OUTPUT_NAME caf_core
)
# -- install library and header files ------------------------------------------
install
(
FILES
"
${
CMAKE_BINARY_DIR
}
/caf/detail/build_config.hpp"
"
${
CMAKE_BINARY_DIR
}
/caf/detail/core_export.hpp"
DESTINATION
"
${
CMAKE_INSTALL_INCLUDEDIR
}
/caf/detail"
)
install
(
TARGETS libcaf_core
EXPORT CAFTargets
ARCHIVE DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
COMPONENT core
RUNTIME DESTINATION
${
CMAKE_INSTALL_BINDIR
}
COMPONENT core
LIBRARY DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
COMPONENT core
)
install
(
DIRECTORY
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/caf"
DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
COMPONENT core
FILES_MATCHING PATTERN
"*.hpp"
)
caf_export_and_install_lib
(
core
)
# -- build unit tests ----------------------------------------------------------
...
...
@@ -231,19 +194,13 @@ add_executable(caf-core-test
test/core-test.cpp
$<TARGET_OBJECTS:libcaf_core_obj>
)
caf_core_set_default_properties
(
caf-core-test
)
target_include_directories
(
caf-core-test PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/test"
)
target_compile_definitions
(
caf-core-test PRIVATE libcaf_core_EXPORTS
)
target_link_libraries
(
caf-core-test PUBLIC CAF::test
)
target_link_libraries
(
caf-core-test PRIVATE
$<TARGET_PROPERTY:libcaf_core,INTERFACE_LINK_LIBRARIES>
)
target_include_directories
(
caf-core-test PRIVATE
"
${
CMAKE_BINARY_DIR
}
"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
)
caf_add_test_suites
(
caf-core-test
actor_clock
actor_factory
...
...
libcaf_io/CMakeLists.txt
View file @
7e99d5c3
...
...
@@ -4,11 +4,26 @@ file(GLOB_RECURSE CAF_IO_HEADERS "caf/*.hpp")
# -- add consistency checks for enum to_string implementations -----------------
add_enum_consistency_check
(
"caf/io/basp/message_type.hpp"
"src/io/basp/message_type_strings.cpp"
)
add_enum_consistency_check
(
"caf/io/network/operation.hpp"
"src/io/network/operation_strings.cpp"
)
caf_add_enum_consistency_check
(
"caf/io/basp/message_type.hpp"
"src/io/basp/message_type_strings.cpp"
)
caf_add_enum_consistency_check
(
"caf/io/network/operation.hpp"
"src/io/network/operation_strings.cpp"
)
# -- utility function for setting default properties ---------------------------
function
(
caf_io_set_default_properties
)
foreach
(
target
${
ARGN
}
)
# Set global defaults and set EXPORTS flag.
caf_set_default_properties
(
${
target
}
)
target_compile_definitions
(
${
target
}
PRIVATE libcaf_io_EXPORTS
)
# Pull in public dependencies.
target_link_libraries
(
${
target
}
PUBLIC CAF::core
)
if
(
MSVC
)
target_link_libraries
(
${
target
}
PUBLIC ws2_32 iphlpapi
)
endif
()
endforeach
()
endfunction
()
# -- add library target --------------------------------------------------------
...
...
@@ -55,60 +70,15 @@ add_library(libcaf_io_obj OBJECT ${CAF_IO_HEADERS}
src/policy/udp.cpp
)
target_include_directories
(
libcaf_io_obj PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
)
set_property
(
TARGET libcaf_io_obj PROPERTY POSITION_INDEPENDENT_CODE ON
)
add_library
(
libcaf_io
"
${
PROJECT_SOURCE_DIR
}
/cmake/dummy.cpp"
$<TARGET_OBJECTS:libcaf_io_obj>
)
target_include_directories
(
libcaf_io INTERFACE
$<BUILD_INTERFACE:
${
CMAKE_CURRENT_SOURCE_DIR
}
>
)
add_library
(
CAF::io ALIAS libcaf_io
)
if
(
BUILD_SHARED_LIBS AND NOT WIN32
)
target_compile_options
(
libcaf_io PRIVATE -fPIC
)
target_compile_options
(
libcaf_io_obj PRIVATE -fPIC
)
endif
()
target_include_directories
(
libcaf_io_obj PRIVATE
$<TARGET_PROPERTY:libcaf_core,INTERFACE_INCLUDE_DIRECTORIES>
)
target_link_libraries
(
libcaf_io PUBLIC CAF::core
)
if
(
MSVC
)
target_link_libraries
(
libcaf_io PUBLIC ws2_32 iphlpapi
)
endif
()
generate_export_header
(
libcaf_io
EXPORT_MACRO_NAME CAF_IO_EXPORT
EXPORT_FILE_NAME
"
${
CMAKE_BINARY_DIR
}
/caf/detail/io_export.hpp"
STATIC_DEFINE CAF_STATIC_BUILD
)
caf_io_set_default_properties
(
libcaf_io_obj libcaf_io
)
target_compile_definitions
(
libcaf_io_obj PRIVATE libcaf_io_EXPORTS
)
set_target_properties
(
libcaf_io PROPERTIES
EXPORT_NAME io
SOVERSION
${
CAF_VERSION
}
VERSION
${
CAF_LIB_VERSION
}
OUTPUT_NAME caf_io
)
# -- install library and header files ------------------------------------------
install
(
FILES
"
${
CMAKE_BINARY_DIR
}
/caf/detail/io_export.hpp"
DESTINATION
"
${
CMAKE_INSTALL_INCLUDEDIR
}
/caf/detail"
)
install
(
TARGETS libcaf_io
EXPORT CAFTargets
ARCHIVE DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
COMPONENT io
LIBRARY DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
COMPONENT io
RUNTIME DESTINATION
${
CMAKE_INSTALL_BINDIR
}
COMPONENT io
)
install
(
DIRECTORY
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/caf"
DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
COMPONENT io
FILES_MATCHING PATTERN
"*.hpp"
)
caf_export_and_install_lib
(
io
)
# -- build unit tests ----------------------------------------------------------
...
...
@@ -120,16 +90,11 @@ add_executable(caf-io-test
test/io-test.cpp
$<TARGET_OBJECTS:libcaf_io_obj>
)
target_include_directories
(
caf-io-test PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/test"
)
target_compile_definitions
(
caf-io-test PRIVATE libcaf_io_EXPORTS
)
caf_io_set_default_properties
(
caf-io-test
)
target_link_libraries
(
caf-io-test PRIVATE CAF::core CAF::test
)
target_link_libraries
(
caf-io-test PRIVATE
$<TARGET_PROPERTY:libcaf_io,INTERFACE_LINK_LIBRARIES>
)
target_include_directories
(
caf-io-test PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/test"
)
target_
include_directories
(
caf-io-test PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
)
target_
link_libraries
(
caf-io-test PRIVATE CAF::test
)
caf_add_test_suites
(
caf-io-test
io.basp.message_queue
...
...
libcaf_openssl/CMakeLists.txt
View file @
7e99d5c3
...
...
@@ -2,6 +2,25 @@
file
(
GLOB_RECURSE CAF_OPENSSL_HEADERS
"caf/*.hpp"
)
# -- dependencies --------------------------------------------------------------
if
(
NOT TARGET OpenSSL::SSL OR NOT TARGET OpenSSL::Crypto
)
find_package
(
OpenSSL REQUIRED
)
endif
()
# -- utility function for setting default properties ---------------------------
function
(
caf_openssl_set_default_properties
)
foreach
(
target
${
ARGN
}
)
# Set global defaults and set EXPORTS flag.
caf_set_default_properties
(
${
target
}
)
target_compile_definitions
(
${
target
}
PRIVATE libcaf_openssl_EXPORTS
)
# Pull in public dependencies.
target_link_libraries
(
${
target
}
PUBLIC
CAF::core CAF::io OpenSSL::SSL OpenSSL::Crypto
)
endforeach
()
endfunction
()
# -- add library target --------------------------------------------------------
add_library
(
libcaf_openssl_obj OBJECT
${
CAF_OPENSSL_HEADERS
}
...
...
@@ -12,69 +31,15 @@ add_library(libcaf_openssl_obj OBJECT ${CAF_OPENSSL_HEADERS}
src/openssl/session.cpp
)
target_include_directories
(
libcaf_openssl_obj PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
)
set_property
(
TARGET libcaf_openssl_obj PROPERTY POSITION_INDEPENDENT_CODE ON
)
add_library
(
libcaf_openssl
"
${
PROJECT_SOURCE_DIR
}
/cmake/dummy.cpp"
$<TARGET_OBJECTS:libcaf_openssl_obj>
)
target_include_directories
(
libcaf_openssl INTERFACE
$<BUILD_INTERFACE:
${
CMAKE_CURRENT_SOURCE_DIR
}
>
)
add_library
(
CAF::openssl ALIAS libcaf_openssl
)
if
(
BUILD_SHARED_LIBS AND NOT WIN32
)
target_compile_options
(
libcaf_openssl PRIVATE -fPIC
)
target_compile_options
(
libcaf_openssl_obj PRIVATE -fPIC
)
endif
()
if
(
NOT TARGET OpenSSL::SSL OR NOT TARGET OpenSSL::Crypto
)
find_package
(
OpenSSL REQUIRED
)
endif
()
target_include_directories
(
libcaf_openssl_obj PRIVATE
$<TARGET_PROPERTY:libcaf_core,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:libcaf_io,INTERFACE_INCLUDE_DIRECTORIES>
${
OPENSSL_INCLUDE_DIR
}
)
target_link_libraries
(
libcaf_openssl PUBLIC
CAF::core CAF::io
OpenSSL::SSL OpenSSL::Crypto
)
generate_export_header
(
libcaf_openssl
EXPORT_MACRO_NAME CAF_OPENSSL_EXPORT
EXPORT_FILE_NAME
"
${
CMAKE_BINARY_DIR
}
/caf/detail/openssl_export.hpp"
STATIC_DEFINE CAF_STATIC_BUILD
)
target_compile_definitions
(
libcaf_openssl_obj PRIVATE libcaf_openssl_EXPORTS
)
target_include_directories
(
libcaf_openssl PUBLIC
$<BUILD_INTERFACE:
${
CMAKE_BINARY_DIR
}
>
$<BUILD_INTERFACE:
${
CMAKE_SOURCE_DIR
}
>
$<INSTALL_INTERFACE:include>
)
set_target_properties
(
libcaf_openssl PROPERTIES
EXPORT_NAME openssl
SOVERSION
${
CAF_VERSION
}
VERSION
${
CAF_LIB_VERSION
}
OUTPUT_NAME caf_openssl
)
caf_openssl_set_default_properties
(
libcaf_openssl_obj libcaf_openssl
)
# -- install library and header files ------------------------------------------
install
(
FILES
"
${
CMAKE_BINARY_DIR
}
/caf/detail/openssl_export.hpp"
DESTINATION
"
${
CMAKE_INSTALL_INCLUDEDIR
}
/caf/detail"
)
install
(
TARGETS libcaf_openssl
EXPORT CAFTargets
ARCHIVE DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
COMPONENT openssl
RUNTIME DESTINATION
${
CMAKE_INSTALL_BINDIR
}
COMPONENT openssl
LIBRARY DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
COMPONENT openssl
)
install
(
DIRECTORY
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/caf"
DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
COMPONENT openssl
FILES_MATCHING PATTERN
"*.hpp"
)
caf_export_and_install_lib
(
openssl
)
# -- build unit tests ----------------------------------------------------------
...
...
@@ -87,15 +52,11 @@ add_executable(caf-openssl-test
${
CAF_OPENSSL_TEST_SOURCES
}
$<TARGET_OBJECTS:libcaf_openssl_obj>
)
target_include_directories
(
caf-openssl-test PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/test"
)
target_compile_definitions
(
caf-openssl-test PRIVATE libcaf_openssl_EXPORTS
)
caf_openssl_set_default_properties
(
caf-openssl-test
)
target_link_libraries
(
caf-openssl-test PRIVATE
CAF::io CAF::core CAF::test OpenSSL::SSL OpenSSL::Crypto
)
target_include_directories
(
caf-openssl-test PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/test"
)
target_include_directories
(
caf-openssl-test PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
)
target_link_libraries
(
caf-openssl-test PRIVATE CAF::test
)
caf_add_test_suites
(
caf-openssl-test
openssl.authentication
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment