Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
actor-incubator
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
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-incubator
Commits
af231735
Commit
af231735
authored
Apr 16, 2020
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix handling of CMake target properties
parent
6188521e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
51 deletions
+53
-51
CMakeLists.txt
CMakeLists.txt
+34
-38
cmake/FindCAF.cmake
cmake/FindCAF.cmake
+11
-9
libcaf_bb/CMakeLists.txt
libcaf_bb/CMakeLists.txt
+2
-0
libcaf_net/CMakeLists.txt
libcaf_net/CMakeLists.txt
+6
-4
No files found.
CMakeLists.txt
View file @
af231735
...
...
@@ -64,48 +64,44 @@ else()
find_package
(
CAF COMPONENTS core test REQUIRED
)
endif
()
# --
base target to propagate dependencies and flags
---------------------------
# --
sanity checks ----------------------------------
---------------------------
add_library
(
caf-incubator-project INTERFACE
)
# -- compiler setup ------------------------------------------------------------
if
(
MSVC
)
# Disable 4275 and 4251 (warnings regarding C++ classes at ABI boundaries).
target_compile_options
(
caf-incubator-project INTERFACE /wd4275 /wd4251
)
if
(
CAF_INC_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.
target_compile_options
(
caf-incubator-project INTERFACE
-ftemplate-depth=512 -ftemplate-backtrace-limit=0
-Wall -Wextra -pedantic
)
if
(
CMAKE_CXX_COMPILER_ID MATCHES
"Clang"
)
# Flags for Clang only.
target_compile_options
(
caf-incubator-project INTERFACE -Wdocumentation
)
else
()
# Flags for GCC only.
target_compile_options
(
caf-incubator-project INTERFACE
-Wno-missing-field-initializers
)
endif
()
if
(
MSVC AND CAF_INC_SANITIZERS
)
message
(
FATAL_ERROR
"Sanitizer builds are currently not supported on MSVC"
)
endif
()
if
(
CAF_INC_SANITIZERS
)
target_compile_options
(
caf-incubator-project INTERFACE
-fsanitize=
${
CAF_INC_SANITIZERS
}
-fno-omit-frame-pointer
)
target_link_libraries
(
caf-incubator-project INTERFACE
-fsanitize=
${
CAF_INC_SANITIZERS
}
-fno-omit-frame-pointer
)
endif
()
if
(
NOT TARGET Threads::Threads
)
find_package
(
Threads REQUIRED
)
endif
()
# -- compiler setup ------------------------------------------------------------
target_link_libraries
(
caf-incubator-project INTERFACE Threads::Threads
)
function
(
caf_incubator_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
-ftemplate-depth=512 -ftemplate-backtrace-limit=0
-Wall -Wextra -pedantic
)
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_INC_SANITIZERS
)
target_compile_options
(
${
target
}
PRIVATE
-fsanitize=
${
CAF_INC_SANITIZERS
}
-fno-omit-frame-pointer
)
target_link_libraries
(
${
target
}
PRIVATE
-fsanitize=
${
CAF_INC_SANITIZERS
}
-fno-omit-frame-pointer
)
endif
()
endforeach
()
endfunction
()
# -- unit testing setup / caf_add_test_suites function ------------------------
...
...
cmake/FindCAF.cmake
View file @
af231735
...
...
@@ -147,9 +147,12 @@ if(CAF_core_FOUND AND NOT TARGET CAF::core)
else
()
set
(
caf_core_include_dirs
"
${
CAF_INCLUDE_DIR_CORE
}
"
)
endif
()
set
(
THREADS_PREFER_PTHREAD_FLAG ON
)
find_package
(
Threads REQUIRED
)
set_target_properties
(
CAF::core PROPERTIES
IMPORTED_LOCATION
"
${
CAF_LIBRARY_CORE
}
"
INTERFACE_INCLUDE_DIRECTORIES
"
${
caf_core_include_dirs
}
"
)
INTERFACE_INCLUDE_DIRECTORIES
"
${
caf_core_include_dirs
}
"
INTERFACE_LINK_LIBRARIES
"Threads::Threads"
)
endif
()
if
(
CAF_io_FOUND AND NOT TARGET CAF::io
)
add_library
(
CAF::io UNKNOWN IMPORTED
)
...
...
@@ -159,18 +162,17 @@ if(CAF_io_FOUND AND NOT TARGET CAF::io)
INTERFACE_LINK_LIBRARIES
"CAF::core"
)
endif
()
if
(
CAF_openssl_FOUND AND NOT TARGET CAF::openssl
)
if
(
BUILD_SHARED_LIBS
)
find_package
(
OpenSSL REQUIRED
)
else
()
set
(
OPENSSL_USE_STATIC_LIBS TRUE
)
find_package
(
OpenSSL REQUIRED
)
endif
()
add_library
(
CAF::openssl UNKNOWN IMPORTED
)
set_target_properties
(
CAF::openssl PROPERTIES
IMPORTED_LOCATION
"
${
CAF_LIBRARY_OPENSSL
}
"
INTERFACE_INCLUDE_DIRECTORIES
"
${
CAF_INCLUDE_DIR_OPENSSL
}
"
INTERFACE_LINK_LIBRARIES
"CAF::core;CAF::io"
)
if
(
NOT BUILD_SHARED_LIBS
)
include
(
CMakeFindDependencyMacro
)
set
(
OPENSSL_USE_STATIC_LIBS TRUE
)
find_dependency
(
OpenSSL
)
set_property
(
TARGET CAF::openssl APPEND PROPERTY
INTERFACE_LINK_LIBRARIES
"OpenSSL::SSL"
)
endif
()
INTERFACE_LINK_LIBRARIES
"CAF::core;CAF::io;OpenSSL::SSL;OpenSSL::Crypto"
)
endif
()
if
(
CAF_test_FOUND AND NOT TARGET CAF::test
)
add_library
(
CAF::test INTERFACE IMPORTED
)
...
...
libcaf_bb/CMakeLists.txt
View file @
af231735
...
...
@@ -32,6 +32,8 @@ endif()
add_executable
(
caf-bb-test test/bb-test.cpp
)
caf_incubator_set_default_properties
(
caf-bb-test
)
target_include_directories
(
caf-bb-test PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/test"
)
...
...
libcaf_net/CMakeLists.txt
View file @
af231735
...
...
@@ -17,17 +17,17 @@ caf_incubator_add_enum_consistency_check("caf/net/operation.hpp"
function
(
caf_net_set_default_properties
)
foreach
(
target
${
ARGN
}
)
caf_incubator_set_default_properties
(
${
target
}
)
# Make sure we find our headers plus the the generated export header.
target_include_directories
(
${
target
}
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
"
${
CMAKE_BINARY_DIR
}
"
)
target_compile_definitions
(
${
target
}
PRIVATE libcaf_net_EXPORTS
)
# Force -fPIC on UNIX systems.
if
(
BUILD_SHARED_LIBS AND UNIX
)
target_compile_options
(
${
target
}
PRIVATE -fPIC
)
endif
()
# Pull in public dependencies.
target_link_libraries
(
${
target
}
PUBLIC CAF::core
)
if
(
MSVC
)
target_link_libraries
(
${
target
}
PUBLIC ws2_32 iphlpapi
)
endif
()
endforeach
()
endfunction
()
...
...
@@ -74,6 +74,8 @@ generate_export_header(libcaf_net
EXPORT_MACRO_NAME CAF_NET_EXPORT
EXPORT_FILE_NAME
"
${
CMAKE_BINARY_DIR
}
/caf/detail/net_export.hpp"
)
set_property
(
TARGET PROPERTY libcaf_net_obj POSITION_INDEPENDENT_CODE ON
)
caf_net_set_default_properties
(
libcaf_net_obj libcaf_net
)
target_include_directories
(
libcaf_net INTERFACE
...
...
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