Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
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
libzmq
Commits
45f4a400
Commit
45f4a400
authored
Apr 17, 2017
by
Luca Boccassi
Committed by
GitHub
Apr 17, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2536 from RPGillespie6/master
Add CMake Build Output Options
parents
1d4014dc
69b2affe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
103 additions
and
76 deletions
+103
-76
CMakeLists.txt
CMakeLists.txt
+103
-76
No files found.
CMakeLists.txt
View file @
45f4a400
...
@@ -290,7 +290,6 @@ if (LIBZMQ_WERROR)
...
@@ -290,7 +290,6 @@ if (LIBZMQ_WERROR)
zmq_check_cxx_flag_prepend
(
"-errwarn=%all"
)
zmq_check_cxx_flag_prepend
(
"-errwarn=%all"
)
endif
()
endif
()
if
(
CMAKE_SYSTEM_PROCESSOR MATCHES
"^sparc"
)
if
(
CMAKE_SYSTEM_PROCESSOR MATCHES
"^sparc"
)
zmq_check_cxx_flag_prepend
(
"-mcpu=v9"
)
zmq_check_cxx_flag_prepend
(
"-mcpu=v9"
)
endif
()
endif
()
...
@@ -724,27 +723,45 @@ endif ()
...
@@ -724,27 +723,45 @@ endif ()
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# output
# output
option
(
BUILD_SHARED
"Whether or not to build the shared object"
ON
)
option
(
BUILD_STATIC
"Whether or not to build the static archive"
ON
)
list
(
APPEND target_outputs
""
)
if
(
BUILD_SHARED
)
list
(
APPEND target_outputs
"zmq-shared"
)
endif
()
if
(
BUILD_STATIC
)
list
(
APPEND target_outputs
"zmq-static"
)
endif
()
if
(
MSVC
)
if
(
MSVC
)
add_library
(
zmq-shared SHARED
${
sources
}
${
public_headers
}
${
html-docs
}
${
readme-docs
}
${
CMAKE_CURRENT_BINARY_DIR
}
/NSIS.template.in
)
if
(
BUILD_SHARED
)
target_link_libraries
(
zmq-shared
${
OPTIONAL_LIBRARIES
}
)
add_library
(
zmq-shared SHARED
${
sources
}
${
public_headers
}
${
html-docs
}
${
readme-docs
}
${
CMAKE_CURRENT_BINARY_DIR
}
/NSIS.template.in
)
set_target_properties
(
zmq-shared PROPERTIES
target_link_libraries
(
zmq-shared
${
OPTIONAL_LIBRARIES
}
)
PUBLIC_HEADER
"
${
public_headers
}
"
set_target_properties
(
zmq-shared PROPERTIES
RELEASE_POSTFIX
"
${
MSVC_TOOLSET
}
-mt-
${
ZMQ_VERSION_MAJOR
}
_
${
ZMQ_VERSION_MINOR
}
_
${
ZMQ_VERSION_PATCH
}
"
PUBLIC_HEADER
"
${
public_headers
}
"
RELWITHDEBINFO_POSTFIX
"
${
MSVC_TOOLSET
}
-mt-
${
ZMQ_VERSION_MAJOR
}
_
${
ZMQ_VERSION_MINOR
}
_
${
ZMQ_VERSION_PATCH
}
"
RELEASE_POSTFIX
"
${
MSVC_TOOLSET
}
-mt-
${
ZMQ_VERSION_MAJOR
}
_
${
ZMQ_VERSION_MINOR
}
_
${
ZMQ_VERSION_PATCH
}
"
DEBUG_POSTFIX
"
${
MSVC_TOOLSET
}
-mt-gd-
${
ZMQ_VERSION_MAJOR
}
_
${
ZMQ_VERSION_MINOR
}
_
${
ZMQ_VERSION_PATCH
}
"
RELWITHDEBINFO_POSTFIX
"
${
MSVC_TOOLSET
}
-mt-
${
ZMQ_VERSION_MAJOR
}
_
${
ZMQ_VERSION_MINOR
}
_
${
ZMQ_VERSION_PATCH
}
"
RUNTIME_OUTPUT_DIRECTORY
"
${
CMAKE_CURRENT_BINARY_DIR
}
/bin"
DEBUG_POSTFIX
"
${
MSVC_TOOLSET
}
-mt-gd-
${
ZMQ_VERSION_MAJOR
}
_
${
ZMQ_VERSION_MINOR
}
_
${
ZMQ_VERSION_PATCH
}
"
COMPILE_DEFINITIONS
"DLL_EXPORT"
RUNTIME_OUTPUT_DIRECTORY
"
${
CMAKE_CURRENT_BINARY_DIR
}
/bin"
OUTPUT_NAME
"libzmq"
)
COMPILE_DEFINITIONS
"DLL_EXPORT"
add_library
(
zmq-static STATIC
${
sources
}
)
OUTPUT_NAME
"libzmq"
)
set_target_properties
(
zmq-static PROPERTIES
endif
()
PUBLIC_HEADER
"
${
public_headers
}
"
RELEASE_POSTFIX
"
${
MSVC_TOOLSET
}
-mt-s-
${
ZMQ_VERSION_MAJOR
}
_
${
ZMQ_VERSION_MINOR
}
_
${
ZMQ_VERSION_PATCH
}
"
if
(
BUILD_STATIC
)
RELWITHDEBINFO_POSTFIX
"
${
MSVC_TOOLSET
}
-mt-s-
${
ZMQ_VERSION_MAJOR
}
_
${
ZMQ_VERSION_MINOR
}
_
${
ZMQ_VERSION_PATCH
}
"
add_library
(
zmq-static STATIC
${
sources
}
)
DEBUG_POSTFIX
"
${
MSVC_TOOLSET
}
-mt-sgd-
${
ZMQ_VERSION_MAJOR
}
_
${
ZMQ_VERSION_MINOR
}
_
${
ZMQ_VERSION_PATCH
}
"
set_target_properties
(
zmq-static PROPERTIES
COMPILE_FLAGS
"/DZMQ_STATIC"
PUBLIC_HEADER
"
${
public_headers
}
"
OUTPUT_NAME
"libzmq"
)
RELEASE_POSTFIX
"
${
MSVC_TOOLSET
}
-mt-s-
${
ZMQ_VERSION_MAJOR
}
_
${
ZMQ_VERSION_MINOR
}
_
${
ZMQ_VERSION_PATCH
}
"
RELWITHDEBINFO_POSTFIX
"
${
MSVC_TOOLSET
}
-mt-s-
${
ZMQ_VERSION_MAJOR
}
_
${
ZMQ_VERSION_MINOR
}
_
${
ZMQ_VERSION_PATCH
}
"
DEBUG_POSTFIX
"
${
MSVC_TOOLSET
}
-mt-sgd-
${
ZMQ_VERSION_MAJOR
}
_
${
ZMQ_VERSION_MINOR
}
_
${
ZMQ_VERSION_PATCH
}
"
COMPILE_FLAGS
"/DZMQ_STATIC"
OUTPUT_NAME
"libzmq"
)
endif
()
else
()
else
()
if
(
BUILD_SHARED
)
add_library
(
zmq-shared SHARED
${
sources
}
${
public_headers
}
${
html-docs
}
${
readme-docs
}
${
zmq-pkgconfig
}
)
add_library
(
zmq-shared SHARED
${
sources
}
${
public_headers
}
${
html-docs
}
${
readme-docs
}
${
zmq-pkgconfig
}
)
# NOTE: the SOVERSION MUST be the same as the one generated by libtool!
# NOTE: the SOVERSION MUST be the same as the one generated by libtool!
set_target_properties
(
zmq-shared PROPERTIES
set_target_properties
(
zmq-shared PROPERTIES
...
@@ -767,15 +784,19 @@ else ()
...
@@ -767,15 +784,19 @@ else ()
set_source_files_properties
(
${
zmq-pkgconfig
}
PROPERTIES
set_source_files_properties
(
${
zmq-pkgconfig
}
PROPERTIES
MACOSX_PACKAGE_LOCATION lib/pkgconfig
)
MACOSX_PACKAGE_LOCATION lib/pkgconfig
)
endif
()
endif
()
endif
()
if
(
BUILD_STATIC
)
add_library
(
zmq-static STATIC
${
sources
}
${
public_headers
}
${
html-docs
}
${
readme-docs
}
${
zmq-pkgconfig
}
)
add_library
(
zmq-static STATIC
${
sources
}
${
public_headers
}
${
html-docs
}
${
readme-docs
}
${
zmq-pkgconfig
}
)
set_target_properties
(
zmq-static PROPERTIES
set_target_properties
(
zmq-static PROPERTIES
PUBLIC_HEADER
"
${
public_headers
}
"
PUBLIC_HEADER
"
${
public_headers
}
"
COMPILE_DEFINITIONS
"ZMQ_STATIC"
COMPILE_DEFINITIONS
"ZMQ_STATIC"
OUTPUT_NAME
"zmq"
OUTPUT_NAME
"zmq"
PREFIX
"lib"
)
PREFIX
"lib"
)
endif
()
endif
()
endif
()
foreach
(
target
zmq-shared zmq-static
)
foreach
(
target
${
target_outputs
}
)
target_include_directories
(
${
target
}
target_include_directories
(
${
target
}
PUBLIC
PUBLIC
$<BUILD_INTERFACE:
${
CMAKE_CURRENT_SOURCE_DIR
}
/include>
$<BUILD_INTERFACE:
${
CMAKE_CURRENT_SOURCE_DIR
}
/include>
...
@@ -784,66 +805,72 @@ foreach (target zmq-shared zmq-static)
...
@@ -784,66 +805,72 @@ foreach (target zmq-shared zmq-static)
)
)
endforeach
()
endforeach
()
target_link_libraries
(
zmq-shared
${
CMAKE_THREAD_LIBS_INIT
}
)
if
(
BUILD_SHARED
)
target_link_libraries
(
zmq-shared
${
CMAKE_THREAD_LIBS_INIT
}
)
if
(
SODIUM_FOUND
)
target_link_libraries
(
zmq-shared
${
SODIUM_LIBRARIES
}
)
endif
()
if
(
HAVE_WS2_32
)
target_link_libraries
(
zmq-shared ws2_32
)
elseif
(
HAVE_WS2
)
target_link_libraries
(
zmq-shared ws2
)
endif
()
if
(
HAVE_RPCRT4
)
target_link_libraries
(
zmq-shared rpcrt4
)
endif
()
if
(
HAVE_IPHLAPI
)
if
(
SODIUM_FOUND
)
target_link_libraries
(
zmq-shared iphlpapi
)
target_link_libraries
(
zmq-shared
${
SODIUM_LIBRARIES
}
)
endif
()
endif
()
if
(
HAVE_WS2_32
)
target_link_libraries
(
zmq-shared ws2_32
)
elseif
(
HAVE_WS2
)
target_link_libraries
(
zmq-shared ws2
)
endif
()
if
(
RT_LIBRARY
)
if
(
HAVE_RPCRT4
)
target_link_libraries
(
zmq-shared
${
RT_LIBRARY
}
)
target_link_libraries
(
zmq-shared rpcrt4
)
endif
()
endif
()
set
(
perf-tools local_lat
if
(
HAVE_IPHLAPI
)
remote_lat
target_link_libraries
(
zmq-shared iphlpapi
)
local_thr
endif
()
remote_thr
inproc_lat
inproc_thr
)
if
(
NOT CMAKE_BUILD_TYPE STREQUAL
"Debug"
)
# Why?
if
(
RT_LIBRARY
)
option
(
WITH_PERF_TOOL
"Build with perf-tools"
ON
)
target_link_libraries
(
zmq-shared
${
RT_LIBRARY
}
)
else
()
endif
()
option
(
WITH_PERF_TOOL
"Build with perf-tools"
OFF
)
endif
()
endif
()
if
(
WITH_PERF_TOOL
)
if
(
BUILD_SHARED
)
foreach
(
perf-tool
${
perf-tools
}
)
set
(
perf-tools local_lat
add_executable
(
${
perf-tool
}
perf/
${
perf-tool
}
.cpp
)
remote_lat
target_link_libraries
(
${
perf-tool
}
zmq-shared
${
OPTIONAL_LIBRARIES
}
)
local_thr
remote_thr
inproc_lat
inproc_thr
)
if
(
RT_LIBRARY
)
if
(
NOT CMAKE_BUILD_TYPE STREQUAL
"Debug"
)
# Why?
target_link_libraries
(
${
perf-tool
}
${
RT_LIBRARY
}
)
option
(
WITH_PERF_TOOL
"Build with perf-tools"
ON
)
endif
()
else
()
option
(
WITH_PERF_TOOL
"Build with perf-tools"
OFF
)
endif
()
if
(
ZMQ_BUILD_FRAMEWORK
)
if
(
WITH_PERF_TOOL
)
# Copy perf-tools binaries into Framework
foreach
(
perf-tool
${
perf-tools
}
)
add_custom_command
(
add_executable
(
${
perf-tool
}
perf/
${
perf-tool
}
.cpp
)
TARGET zmq-shared
${
perf-tool
}
target_link_libraries
(
${
perf-tool
}
zmq-shared
${
OPTIONAL_LIBRARIES
}
)
POST_BUILD
COMMAND
${
CMAKE_COMMAND
}
if
(
RT_LIBRARY
)
ARGS -E copy
"$<TARGET_FILE:
${
perf-tool
}
>"
"
${
LIBRARY_OUTPUT_PATH
}
/ZeroMQ.framework/Versions/
${
ZMQ_VERSION_STRING
}
/MacOS/
${
perf-tool
}
"
target_link_libraries
(
${
perf-tool
}
${
RT_LIBRARY
}
)
VERBATIM
endif
()
COMMENT
"Perf tools"
)
else
()
if
(
ZMQ_BUILD_FRAMEWORK
)
install
(
TARGETS
${
perf-tool
}
# Copy perf-tools binaries into Framework
RUNTIME DESTINATION bin
add_custom_command
(
COMPONENT PerfTools
)
TARGET zmq-shared
${
perf-tool
}
endif
()
POST_BUILD
endforeach
()
COMMAND
${
CMAKE_COMMAND
}
ARGS -E copy
"$<TARGET_FILE:
${
perf-tool
}
>"
"
${
LIBRARY_OUTPUT_PATH
}
/ZeroMQ.framework/Versions/
${
ZMQ_VERSION_STRING
}
/MacOS/
${
perf-tool
}
"
VERBATIM
COMMENT
"Perf tools"
)
else
()
install
(
TARGETS
${
perf-tool
}
RUNTIME DESTINATION bin
COMPONENT PerfTools
)
endif
()
endforeach
()
endif
()
elseif
(
WITH_PERF_TOOL
)
message
(
FATAL_ERROR
"Shared library disabled - perf-tools unavailable."
)
endif
()
endif
()
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
...
@@ -862,14 +889,14 @@ endif ()
...
@@ -862,14 +889,14 @@ endif ()
include
(
GNUInstallDirs
)
include
(
GNUInstallDirs
)
if
(
MSVC
)
if
(
MSVC
)
install
(
TARGETS
zmq-shared zmq-static
install
(
TARGETS
${
target_outputs
}
EXPORT
${
PROJECT_NAME
}
-targets
EXPORT
${
PROJECT_NAME
}
-targets
ARCHIVE DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
ARCHIVE DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
LIBRARY DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
LIBRARY DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
PUBLIC_HEADER DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
PUBLIC_HEADER DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
COMPONENT SDK
)
COMPONENT SDK
)
if
(
CMAKE_BUILD_TYPE STREQUAL
"Debug"
)
if
(
CMAKE_BUILD_TYPE STREQUAL
"Debug"
)
install
(
TARGETS
zmq-shared zmq-static
install
(
TARGETS
${
target_outputs
}
RUNTIME DESTINATION
${
CMAKE_INSTALL_BINDIR
}
RUNTIME DESTINATION
${
CMAKE_INSTALL_BINDIR
}
ARCHIVE DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
ARCHIVE DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
PUBLIC_HEADER DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
PUBLIC_HEADER DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
...
@@ -878,14 +905,14 @@ if (MSVC)
...
@@ -878,14 +905,14 @@ if (MSVC)
install
(
FILES
${
CMAKE_CURRENT_BINARY_DIR
}
/bin/libzmq
${
MSVC_TOOLSET
}
-mt-gd-
${
ZMQ_VERSION_MAJOR
}
_
${
ZMQ_VERSION_MINOR
}
_
${
ZMQ_VERSION_PATCH
}
.pdb DESTINATION lib
install
(
FILES
${
CMAKE_CURRENT_BINARY_DIR
}
/bin/libzmq
${
MSVC_TOOLSET
}
-mt-gd-
${
ZMQ_VERSION_MAJOR
}
_
${
ZMQ_VERSION_MINOR
}
_
${
ZMQ_VERSION_PATCH
}
.pdb DESTINATION lib
COMPONENT SDK
)
COMPONENT SDK
)
endif
()
endif
()
else
(
)
else
if
(
BUILD_SHARED
)
install
(
TARGETS zmq-shared
install
(
TARGETS zmq-shared
RUNTIME DESTINATION
${
CMAKE_INSTALL_BINDIR
}
RUNTIME DESTINATION
${
CMAKE_INSTALL_BINDIR
}
PUBLIC_HEADER DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
PUBLIC_HEADER DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
COMPONENT Runtime
)
COMPONENT Runtime
)
endif
()
endif
()
else
()
else
()
install
(
TARGETS
zmq-shared zmq-static
install
(
TARGETS
${
target_outputs
}
EXPORT
${
PROJECT_NAME
}
-targets
EXPORT
${
PROJECT_NAME
}
-targets
RUNTIME DESTINATION
${
CMAKE_INSTALL_BINDIR
}
RUNTIME DESTINATION
${
CMAKE_INSTALL_BINDIR
}
ARCHIVE DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
ARCHIVE DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
...
...
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