From b1d4955065e017caaa2d59ad74f15d723f6fe284 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 28 Jun 2018 15:51:43 -0400 Subject: [PATCH] cmake: Streamline integration allowing config of CMAKE_*_OUTPUT_DIRECTORY Setting EXECUTABLE_OUTPUT_PATH and LIBRARY_OUTPUT_PATH variables is deprecated --- CMakeLists.txt | 15 +++++++++++++-- builds/cmake/Modules/ZMQSupportMacros.cmake | 5 +++++ 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 builds/cmake/Modules/ZMQSupportMacros.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 99e75c3d..ce43692d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,6 +35,8 @@ if(COMPILER_SUPPORTS_C11) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11") endif() +include (ZMQSupportMacros) + if(NOT MSVC) # clang 6 has a warning that does not make sense on multi-platform code CHECK_CXX_COMPILER_FLAG("-Wno-tautological-constant-compare" CXX_HAS_TAUT_WARNING) @@ -549,8 +551,17 @@ if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) FORCE) endif () -set (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin) -set (LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/lib) +#----------------------------------------------------------------------------- +# output directories + +zmq_set_with_default(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${ZeroMQ_BINARY_DIR}/bin") +if(UNIX) + set(zmq_library_directory "lib") +else() + set(zmq_library_directory "bin") +endif() +zmq_set_with_default(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${ZeroMQ_BINARY_DIR}/${zmq_library_directory}") +zmq_set_with_default(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${ZeroMQ_BINARY_DIR}/lib") #----------------------------------------------------------------------------- # platform specifics diff --git a/builds/cmake/Modules/ZMQSupportMacros.cmake b/builds/cmake/Modules/ZMQSupportMacros.cmake new file mode 100644 index 00000000..5139015f --- /dev/null +++ b/builds/cmake/Modules/ZMQSupportMacros.cmake @@ -0,0 +1,5 @@ +macro (zmq_set_with_default var value) + if (NOT ${var}) + set(${var} "${value}") + endif () +endmacro ()