Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
55ed1d42
Commit
55ed1d42
authored
Jul 03, 2019
by
boscosiu
Committed by
Adam Cozzette
Jul 03, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
link libatomic on systems without adequate builtin atomics
parent
de3e728c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
1 deletion
+23
-1
CMakeLists.txt
cmake/CMakeLists.txt
+16
-0
libprotobuf-lite.cmake
cmake/libprotobuf-lite.cmake
+3
-0
libprotobuf.cmake
cmake/libprotobuf.cmake
+4
-1
No files found.
cmake/CMakeLists.txt
View file @
55ed1d42
...
...
@@ -132,6 +132,22 @@ if (HAVE_ZLIB)
add_definitions
(
-DHAVE_ZLIB
)
endif
(
HAVE_ZLIB
)
# We need to link with libatomic on systems that do not have builtin atomics, or
# don't have builtin support for 8 byte atomics
set
(
protobuf_LINK_LIBATOMIC false
)
if
(
NOT MSVC
)
include
(
CheckCXXSourceCompiles
)
check_cxx_source_compiles
(
"
#include <atomic>
int main() {
return std::atomic<int64_t>{};
}
"
protobuf_HAVE_BUILTIN_ATOMICS
)
if
(
NOT protobuf_HAVE_BUILTIN_ATOMICS
)
set
(
protobuf_LINK_LIBATOMIC true
)
endif
(
NOT protobuf_HAVE_BUILTIN_ATOMICS
)
endif
(
NOT MSVC
)
if
(
protobuf_BUILD_SHARED_LIBS
)
set
(
protobuf_SHARED_OR_STATIC
"SHARED"
)
else
(
protobuf_BUILD_SHARED_LIBS
)
...
...
cmake/libprotobuf-lite.cmake
View file @
55ed1d42
...
...
@@ -64,6 +64,9 @@ endif()
add_library
(
libprotobuf-lite
${
protobuf_SHARED_OR_STATIC
}
${
libprotobuf_lite_files
}
${
libprotobuf_lite_includes
}
${
libprotobuf_lite_rc_files
}
)
target_link_libraries
(
libprotobuf-lite
${
CMAKE_THREAD_LIBS_INIT
}
)
if
(
protobuf_LINK_LIBATOMIC
)
target_link_libraries
(
libprotobuf-lite atomic
)
endif
()
target_include_directories
(
libprotobuf-lite PUBLIC
${
protobuf_source_dir
}
/src
)
if
(
MSVC AND protobuf_BUILD_SHARED_LIBS
)
target_compile_definitions
(
libprotobuf-lite
...
...
cmake/libprotobuf.cmake
View file @
55ed1d42
...
...
@@ -118,7 +118,10 @@ add_library(libprotobuf ${protobuf_SHARED_OR_STATIC}
${
libprotobuf_lite_files
}
${
libprotobuf_files
}
${
libprotobuf_includes
}
${
libprotobuf_rc_files
}
)
target_link_libraries
(
libprotobuf
${
CMAKE_THREAD_LIBS_INIT
}
)
if
(
protobuf_WITH_ZLIB
)
target_link_libraries
(
libprotobuf
${
ZLIB_LIBRARIES
}
)
target_link_libraries
(
libprotobuf
${
ZLIB_LIBRARIES
}
)
endif
()
if
(
protobuf_LINK_LIBATOMIC
)
target_link_libraries
(
libprotobuf atomic
)
endif
()
target_include_directories
(
libprotobuf PUBLIC
${
protobuf_source_dir
}
/src
)
if
(
MSVC AND protobuf_BUILD_SHARED_LIBS
)
...
...
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