summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2016-03-16 22:36:24 +0000
committerAndrew Stitcher <astitcher@apache.org>2016-03-16 22:36:24 +0000
commit9db3c30218c417dc5bfb3b7fbba85643969f3c90 (patch)
treeb7137019c83549f07e19887849aa483233267c19
parenta13774c897218ba99d55a743ab77ba9179b93ff3 (diff)
downloadqpid-python-9db3c30218c417dc5bfb3b7fbba85643969f3c90.tar.gz
QPID-7148: Update CMake files to use better more modern style and features
- This is already the way we do this stuff in Qpid Proton - Upgrade minimum version of CMake to 2.8.7 git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1735324 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/cpp/CMakeLists.txt47
-rw-r--r--qpid/cpp/bindings/qmf2/examples/cpp/CMakeLists.txt5
-rw-r--r--qpid/cpp/docs/api/CMakeLists.txt2
-rw-r--r--qpid/cpp/examples/CMakeLists.txt5
-rw-r--r--qpid/cpp/examples/messaging/extra_dist/CMakeLists.txt2
-rw-r--r--qpid/cpp/examples/winsdk-cmake/CMakeLists.txt189
-rw-r--r--qpid/cpp/managementgen/CMakeLists.txt4
-rw-r--r--qpid/cpp/src/msvc.cmake287
-rw-r--r--qpid/cpp/src/tests/CMakeLists.txt65
-rw-r--r--qpid/cpp/src/tests/legacystore/CMakeLists.txt3
10 files changed, 275 insertions, 334 deletions
diff --git a/qpid/cpp/CMakeLists.txt b/qpid/cpp/CMakeLists.txt
index f9e0a5745e..93ebd6ce05 100644
--- a/qpid/cpp/CMakeLists.txt
+++ b/qpid/cpp/CMakeLists.txt
@@ -17,25 +17,26 @@
# under the License.
#
-# Set default build type. Must come before project() which sets default to ""
-set (CMAKE_BUILD_TYPE RelWithDebInfo CACHE string
- "Build type: Debug, Release, RelWithDebInfo or MinSizeRel (default RelWithDebInfo)")
-if (CMAKE_BUILD_TYPE MATCHES "Deb")
- set (has_debug_symbols " (has debug symbols)")
-endif (CMAKE_BUILD_TYPE MATCHES "Deb")
-
project(qpid-cpp)
-cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
-if(COMMAND cmake_policy)
- cmake_policy(VERSION 2.6)
-endif(COMMAND cmake_policy)
-
-if (${CMAKE_VERSION} VERSION_LESS "2.8.0")
- set (OPTIONAL_ARG "")
-else()
- set (OPTIONAL_ARG OPTIONAL)
-endif()
+cmake_minimum_required(VERSION 2.8.7 FATAL_ERROR)
+
+if (CMAKE_CONFIGURATION_TYPES)
+ # There is no single "build type"...
+ message(STATUS "Build types are ${CMAKE_CONFIGURATION_TYPES}")
+else (CMAKE_CONFIGURATION_TYPES)
+ # There is a single build configuration
+ # If the build type is not set then set the default
+ if (NOT CMAKE_BUILD_TYPE)
+ set (CMAKE_BUILD_TYPE RelWithDebInfo CACHE string
+ "Build type: Debug, Release, RelWithDebInfo or MinSizeRel (default RelWithDebInfo)" FORCE)
+ endif ()
+
+ if (CMAKE_BUILD_TYPE MATCHES "Deb")
+ set (has_debug_symbols " (has debug symbols)")
+ endif (CMAKE_BUILD_TYPE MATCHES "Deb")
+ message(STATUS "Build type is \"${CMAKE_BUILD_TYPE}\"${has_debug_symbols}")
+endif (CMAKE_CONFIGURATION_TYPES)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMakeModules)
@@ -107,13 +108,7 @@ set(CPACK_PACKAGE_VERSION_PATCH "0")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "qpidc-${qpidc_version}")
# Add custom target for docs since we don't include a cmake file there directly.
-# If we can't use OPTIONAL in the install command then we have to make the docs
-# every time so that the install target succeeds
-if (OPTIONAL_ARG)
- add_custom_target(docs)
-else (OPTIONAL_ARG)
- add_custom_target(docs ALL)
-endif (OPTIONAL_ARG)
+add_custom_target(docs)
# uninstall target
configure_file(
@@ -239,7 +234,3 @@ add_subdirectory(docs/man)
add_subdirectory(examples)
include (CPack)
-
-# Build type message again, last so it is visible at end of output.
-message(STATUS "Build type is \"${CMAKE_BUILD_TYPE}\"${has_debug_symbols}")
-
diff --git a/qpid/cpp/bindings/qmf2/examples/cpp/CMakeLists.txt b/qpid/cpp/bindings/qmf2/examples/cpp/CMakeLists.txt
index 32fce36e1d..2a01f333ae 100644
--- a/qpid/cpp/bindings/qmf2/examples/cpp/CMakeLists.txt
+++ b/qpid/cpp/bindings/qmf2/examples/cpp/CMakeLists.txt
@@ -17,10 +17,7 @@
# under the License.
#
project(qmf2_examples)
-cmake_minimum_required(VERSION 2.4.0 FATAL_ERROR)
-if(COMMAND cmake_policy)
- cmake_policy(SET CMP0003 NEW)
-endif(COMMAND cmake_policy)
+cmake_minimum_required(VERSION 2.8.7 FATAL_ERROR)
include_directories(${CMAKE_BINARY_DIR}/include)
include_directories(${CMAKE_SOURCE_DIR}/include)
diff --git a/qpid/cpp/docs/api/CMakeLists.txt b/qpid/cpp/docs/api/CMakeLists.txt
index 79e0d58db5..e48f4fd63d 100644
--- a/qpid/cpp/docs/api/CMakeLists.txt
+++ b/qpid/cpp/docs/api/CMakeLists.txt
@@ -36,7 +36,7 @@ if (BUILD_DOCS)
install (DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/
DESTINATION ${QPID_INSTALL_DOCDIR}/api/html
COMPONENT ${QPID_COMPONENT_CLIENT_INCLUDE}
- ${OPTIONAL_ARG})
+ OPTIONAL)
if (CPACK_GENERATOR STREQUAL "NSIS")
set (CPACK_NSIS_MENU_LINKS
"${QPID_INSTALL_HTMLDIR}/index.html" "Qpid C++ API Documentation"
diff --git a/qpid/cpp/examples/CMakeLists.txt b/qpid/cpp/examples/CMakeLists.txt
index 7b0e61e3df..7bcc8d7261 100644
--- a/qpid/cpp/examples/CMakeLists.txt
+++ b/qpid/cpp/examples/CMakeLists.txt
@@ -17,10 +17,7 @@
# under the License.
#
project(qpidc_examples)
-cmake_minimum_required(VERSION 2.4.0 FATAL_ERROR)
-if(COMMAND cmake_policy)
- cmake_policy(SET CMP0003 NEW)
-endif(COMMAND cmake_policy)
+cmake_minimum_required(VERSION 2.8.7 FATAL_ERROR)
include_directories(${CMAKE_BINARY_DIR}/include)
include_directories(${CMAKE_SOURCE_DIR}/include)
diff --git a/qpid/cpp/examples/messaging/extra_dist/CMakeLists.txt b/qpid/cpp/examples/messaging/extra_dist/CMakeLists.txt
index be44adaedb..519338ea80 100644
--- a/qpid/cpp/examples/messaging/extra_dist/CMakeLists.txt
+++ b/qpid/cpp/examples/messaging/extra_dist/CMakeLists.txt
@@ -17,7 +17,7 @@
# under the License.
#
-cmake_minimum_required (VERSION 2.6)
+cmake_minimum_required (VERSION 2.8.7)
project (Examples)
diff --git a/qpid/cpp/examples/winsdk-cmake/CMakeLists.txt b/qpid/cpp/examples/winsdk-cmake/CMakeLists.txt
index 6f089625ca..a59bdca954 100644
--- a/qpid/cpp/examples/winsdk-cmake/CMakeLists.txt
+++ b/qpid/cpp/examples/winsdk-cmake/CMakeLists.txt
@@ -1,95 +1,94 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-#
-# Description
-# For WinSDK:
-# Top-level CMake source to build version-independent C++
-# example solution and project files for Visual Studio.
-#
-# Usage:
-# Target: Visual Studio 2008, 32-bit
-# cd <WinSDK>\examples\examples-cmake
-# cmake -G "Visual Studio 9 2008" .
-#
-# Target: Visual Studio 2008, 64-bit
-# cd <WinSDK>\examples\examples-cmake
-# cmake -G "Visual Studio 9 2008 Win64" .
-#
-# Target: Visual Studio 2010, 32-bit
-# cd <WinSDK>\examples\examples-cmake
-# cmake -G "Visual Studio 10" .
-#
-# Target: Visual Studio 2010, 64-bit
-# cd <WinSDK>\examples\examples-cmake
-# cmake -G "Visual Studio 10 Win64" .
-#
-# Then execute the examples.sln created by cmake to build
-# the examples in Debug or Release configurations.
-#
-
-project(examples)
-
-set (CMAKE_VERBOSE_MAKEFILE ON)
-
-cmake_minimum_required(VERSION 2.8.6 FATAL_ERROR)
-cmake_policy (SET CMP0015 NEW)
-
-set (CMAKE_SUPPRESS_REGENERATION TRUE)
-
-add_definitions(
- /D "_CRT_NONSTDC_NO_WARNINGS"
- /D "NOMINMAX"
- /D "WIN32_LEAN_AND_MEAN"
-)
-
-set (CMAKE_DEBUG_POSTFIX "d")
-
-include_directories ( "../../include" )
-link_directories ( "../../lib" )
-
-macro(add_example_properties example)
- set_target_properties(${example} PROPERTIES OUTPUT_NAME "${example}" )
- set_target_properties(${example} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../bin/${CMAKE_BUILD_TYPE})
-
- target_link_libraries(${example} optimized qpidmessaging debug qpidmessagingd)
- target_link_libraries(${example} optimized qpidcommon debug qpidcommond )
- target_link_libraries(${example} optimized qpidtypes debug qpidtypesd )
-endmacro(add_example_properties)
-
-macro(add_example srcdirectory example)
- add_executable(${example} ../${srcdirectory}/${example}.cpp)
- add_example_properties(${example})
-endmacro(add_example)
-
-macro(add_example_with_parser srcdirectory example)
- add_executable(${example} ../${srcdirectory}/${example}.cpp ../messaging/OptionParser.cpp)
- add_example_properties(${example})
-endmacro(add_example_with_parser)
-
-add_example_with_parser(messaging drain)
-add_example_with_parser(messaging spout)
-
-add_example(messaging map_receiver)
-add_example(messaging map_sender)
-add_example(messaging client)
-add_example(messaging server)
-add_example(messaging server_reconnect)
-add_example(messaging hello_world)
-add_example(messaging hello_xml)
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#
+# Description
+# For WinSDK:
+# Top-level CMake source to build version-independent C++
+# example solution and project files for Visual Studio.
+#
+# Usage:
+# Target: Visual Studio 2008, 32-bit
+# cd <WinSDK>\examples\examples-cmake
+# cmake -G "Visual Studio 9 2008" .
+#
+# Target: Visual Studio 2008, 64-bit
+# cd <WinSDK>\examples\examples-cmake
+# cmake -G "Visual Studio 9 2008 Win64" .
+#
+# Target: Visual Studio 2010, 32-bit
+# cd <WinSDK>\examples\examples-cmake
+# cmake -G "Visual Studio 10" .
+#
+# Target: Visual Studio 2010, 64-bit
+# cd <WinSDK>\examples\examples-cmake
+# cmake -G "Visual Studio 10 Win64" .
+#
+# Then execute the examples.sln created by cmake to build
+# the examples in Debug or Release configurations.
+#
+
+project(examples)
+
+set (CMAKE_VERBOSE_MAKEFILE ON)
+
+cmake_minimum_required(VERSION 2.8.7 FATAL_ERROR)
+
+set (CMAKE_SUPPRESS_REGENERATION TRUE)
+
+add_definitions(
+ /D "_CRT_NONSTDC_NO_WARNINGS"
+ /D "NOMINMAX"
+ /D "WIN32_LEAN_AND_MEAN"
+)
+
+set (CMAKE_DEBUG_POSTFIX "d")
+
+include_directories ( "../../include" )
+link_directories ( "../../lib" )
+
+macro(add_example_properties example)
+ set_target_properties(${example} PROPERTIES OUTPUT_NAME "${example}" )
+ set_target_properties(${example} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../bin/${CMAKE_BUILD_TYPE})
+
+ target_link_libraries(${example} optimized qpidmessaging debug qpidmessagingd)
+ target_link_libraries(${example} optimized qpidcommon debug qpidcommond )
+ target_link_libraries(${example} optimized qpidtypes debug qpidtypesd )
+endmacro(add_example_properties)
+
+macro(add_example srcdirectory example)
+ add_executable(${example} ../${srcdirectory}/${example}.cpp)
+ add_example_properties(${example})
+endmacro(add_example)
+
+macro(add_example_with_parser srcdirectory example)
+ add_executable(${example} ../${srcdirectory}/${example}.cpp ../messaging/OptionParser.cpp)
+ add_example_properties(${example})
+endmacro(add_example_with_parser)
+
+add_example_with_parser(messaging drain)
+add_example_with_parser(messaging spout)
+
+add_example(messaging map_receiver)
+add_example(messaging map_sender)
+add_example(messaging client)
+add_example(messaging server)
+add_example(messaging server_reconnect)
+add_example(messaging hello_world)
+add_example(messaging hello_xml)
diff --git a/qpid/cpp/managementgen/CMakeLists.txt b/qpid/cpp/managementgen/CMakeLists.txt
index 4d1bbe18d9..1bb8db853b 100644
--- a/qpid/cpp/managementgen/CMakeLists.txt
+++ b/qpid/cpp/managementgen/CMakeLists.txt
@@ -20,7 +20,7 @@ option(INSTALL_QMFGEN "Install QMF-GEN and QMF Python site-packages" ON)
if (INSTALL_QMFGEN)
project(qpidc-qmfgen)
- cmake_minimum_required(VERSION 2.4.0 FATAL_ERROR)
+ cmake_minimum_required(VERSION 2.8.7 FATAL_ERROR)
find_package(PythonInterp REQUIRED)
@@ -37,4 +37,4 @@ if (INSTALL_QMFGEN)
PATTERN ".svn" EXCLUDE PATTERN "*.pyc" EXCLUDE)
else (INSTALL_QMFGEN)
message (STATUS "Skipping installing qmf-gen and qmf python site-packages")
-endif (INSTALL_QMFGEN) \ No newline at end of file
+endif (INSTALL_QMFGEN)
diff --git a/qpid/cpp/src/msvc.cmake b/qpid/cpp/src/msvc.cmake
index dc248f4f96..4aa2f71513 100644
--- a/qpid/cpp/src/msvc.cmake
+++ b/qpid/cpp/src/msvc.cmake
@@ -1,149 +1,138 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-# This file provides library support for MSVC builds.
-# * Allows for detailed specification of file/product versions.
-# * Installs PDB files.
-
-#
-# If the compiler is Visual Studio set up installation of .pdb files
-#
-# Sample: install_pdb (qpidcommon ${QPID_COMPONENT_COMMON})
-#
-MACRO (install_pdb theLibrary theComponent)
- if (MSVC)
- get_target_property(library_dll ${theLibrary} LOCATION)
- string(REPLACE .dll .pdb library_pdb ${library_dll})
- string(REPLACE $(OutDir) \${CMAKE_INSTALL_CONFIG_NAME} library_pdb ${library_pdb})
- string(REPLACE $(Configuration) \${CMAKE_INSTALL_CONFIG_NAME} library_pdb ${library_pdb})
- string(REPLACE .pdb d.pdb libraryd_pdb ${library_pdb})
- #message(STATUS "_pdb: ${library_pdb}, ${libraryd_pdb}")
- install (PROGRAMS
- ${library_pdb}
- DESTINATION ${QPID_INSTALL_LIBDIR}/ReleasePDB
- COMPONENT ${theComponent}
- OPTIONAL
- CONFIGURATIONS Release|MinSizeRel)
- install (PROGRAMS
- ${library_pdb}
- DESTINATION ${QPID_INSTALL_LIBDIR}/ReleasePDB
- COMPONENT ${theComponent}
- CONFIGURATIONS RelWithDebInfo)
- install (PROGRAMS
- ${libraryd_pdb}
- DESTINATION ${QPID_INSTALL_LIBDIR}/DebugPDB
- COMPONENT ${theComponent}
- CONFIGURATIONS Debug)
- endif (MSVC)
-ENDMACRO (install_pdb)
-
-#
-# inherit_value - if the symbol is undefined then set it to the given value.
-# Set flag to indicate this symbol was defined here.
-#
-MACRO (inherit_value theSymbol theValue)
- if (NOT DEFINED ${theSymbol})
- set (${theSymbol} ${theValue})
- # message ("Set symbol '${theSymbol}' to value '${theValue}'")
- set (${theSymbol}_inherited = "true")
- endif (NOT DEFINED ${theSymbol})
-ENDMACRO (inherit_value)
-
-#
-# If compiler is Visual Studio then create a "version resource" for the project.
-# Use this call to override CPACK and file global settings but not file per-project settings.
-# Two groups of four version numbers specify "file" and "product" versions separately.
-#
-# Sample: add_msvc_version_full (qmfengine library dll 1 0 0 1 1 0 0 1)
-#
-MACRO (add_msvc_version_full verProject verProjectType verProjectFileExt verFN1 verFN2 verFN3 verFN4 verPN1 verPN2 verPN3 verPN4)
- if (MSVC)
- # Create project-specific version strings
- inherit_value ("winver_${verProject}_FileVersionBinary" "${verFN1},${verFN2},${verFN3},${verFN4}")
- inherit_value ("winver_${verProject}_ProductVersionBinary" "${verPN1},${verPN2},${verPN3},${verPN4}")
- inherit_value ("winver_${verProject}_FileVersionString" "${verFN1}, ${verFN2}, ${verFN3}, ${verFN4}")
- inherit_value ("winver_${verProject}_ProductVersionString" "${verPN1}, ${verPN2}, ${verPN3}, ${verPN4}")
- inherit_value ("winver_${verProject}_FileDescription" "${winver_PACKAGE_NAME}-${verProject} ${verProjectType}")
- inherit_value ("winver_${verProject}_LegalCopyright" "${winver_LEGAL_COPYRIGHT}")
- inherit_value ("winver_${verProject}_InternalName" "${verProject}")
- inherit_value ("winver_${verProject}_OriginalFilename" "${verProject}.${verProjectFileExt}")
- inherit_value ("winver_${verProject}_ProductName" "${winver_DESCRIPTION_SUMMARY}")
-
- # Create strings to be substituted into the template file
- set ("winverFileVersionBinary" "${winver_${verProject}_FileVersionBinary}")
- set ("winverProductVersionBinary" "${winver_${verProject}_ProductVersionBinary}")
- set ("winverFileVersionString" "${winver_${verProject}_FileVersionString}")
- set ("winverProductVersionString" "${winver_${verProject}_ProductVersionString}")
- set ("winverFileDescription" "${winver_${verProject}_FileDescription}")
- set ("winverLegalCopyright" "${winver_${verProject}_LegalCopyright}")
- set ("winverInternalName" "${winver_${verProject}_InternalName}")
- set ("winverOriginalFilename" "${winver_${verProject}_OriginalFilename}")
- set ("winverProductName" "${winver_${verProject}_ProductName}")
-
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/windows/resources/template-resource.rc
- ${CMAKE_CURRENT_BINARY_DIR}/windows/resources/${verProject}-resource.rc)
- set (${verProject}_SOURCES
- ${${verProject}_SOURCES}
- ${CMAKE_CURRENT_BINARY_DIR}/windows/resources/${verProject}-resource.rc
- )
- endif (MSVC)
-ENDMACRO (add_msvc_version_full)
-
-#
-# If compiler is Visual Studio then create a "version resource" for the project.
-# Use this call to accept file override version settings or
-# inherited CPACK_PACKAGE_VERSION version settings.
-#
-# Sample: add_msvc_version (qpidcommon library dll)
-#
-MACRO (add_msvc_version verProject verProjectType verProjectFileExt)
- if (MSVC)
- add_msvc_version_full (${verProject}
- ${verProjectType}
- ${verProjectFileExt}
- ${winver_FILE_VERSION_N1}
- ${winver_FILE_VERSION_N2}
- ${winver_FILE_VERSION_N3}
- ${winver_FILE_VERSION_N4}
- ${winver_PRODUCT_VERSION_N1}
- ${winver_PRODUCT_VERSION_N2}
- ${winver_PRODUCT_VERSION_N3}
- ${winver_PRODUCT_VERSION_N4})
- endif (MSVC)
-ENDMACRO (add_msvc_version)
-
-#
-# Install optional windows version settings. Override variables are specified in a file.
-#
-include (./CMakeWinVersions.cmake OPTIONAL)
-
-#
-# Inherit global windows version settings from CPACK settings.
-#
-inherit_value ("winver_PACKAGE_NAME" "${CPACK_PACKAGE_NAME}")
-inherit_value ("winver_DESCRIPTION_SUMMARY" "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}")
-inherit_value ("winver_FILE_VERSION_N1" "${CPACK_PACKAGE_VERSION_MAJOR}")
-inherit_value ("winver_FILE_VERSION_N2" "${CPACK_PACKAGE_VERSION_MINOR}")
-inherit_value ("winver_FILE_VERSION_N3" "${CPACK_PACKAGE_VERSION_PATCH}")
-inherit_value ("winver_FILE_VERSION_N4" "1")
-inherit_value ("winver_PRODUCT_VERSION_N1" "${winver_FILE_VERSION_N1}")
-inherit_value ("winver_PRODUCT_VERSION_N2" "${winver_FILE_VERSION_N2}")
-inherit_value ("winver_PRODUCT_VERSION_N3" "${winver_FILE_VERSION_N3}")
-inherit_value ("winver_PRODUCT_VERSION_N4" "${winver_FILE_VERSION_N4}")
-inherit_value ("winver_LEGAL_COPYRIGHT" "")
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# This file provides library support for MSVC builds.
+# * Allows for detailed specification of file/product versions.
+# * Installs PDB files.
+
+#
+# If the compiler is Visual Studio set up installation of .pdb files
+#
+# Sample: install_pdb (qpidcommon ${QPID_COMPONENT_COMMON})
+#
+MACRO (install_pdb theLibrary theComponent)
+ if (MSVC)
+ install (FILES
+ $<TARGET_PDB_FILE:${theLibrary}>
+ DESTINATION ${QPID_INSTALL_LIBDIR}/ReleasePDB
+ COMPONENT ${theComponent}
+ OPTIONAL
+ CONFIGURATIONS Release MinSizeRel RelWithDebInfo)
+ install (FILES
+ $<TARGET_PDB_FILE:${theLibrary}>
+ DESTINATION ${QPID_INSTALL_LIBDIR}/DebugPDB
+ COMPONENT ${theComponent}
+ CONFIGURATIONS Debug)
+ endif (MSVC)
+ENDMACRO (install_pdb)
+
+#
+# inherit_value - if the symbol is undefined then set it to the given value.
+# Set flag to indicate this symbol was defined here.
+#
+MACRO (inherit_value theSymbol theValue)
+ if (NOT DEFINED ${theSymbol})
+ set (${theSymbol} ${theValue})
+ # message ("Set symbol '${theSymbol}' to value '${theValue}'")
+ set (${theSymbol}_inherited = "true")
+ endif (NOT DEFINED ${theSymbol})
+ENDMACRO (inherit_value)
+
+#
+# If compiler is Visual Studio then create a "version resource" for the project.
+# Use this call to override CPACK and file global settings but not file per-project settings.
+# Two groups of four version numbers specify "file" and "product" versions separately.
+#
+# Sample: add_msvc_version_full (qmfengine library dll 1 0 0 1 1 0 0 1)
+#
+MACRO (add_msvc_version_full verProject verProjectType verProjectFileExt verFN1 verFN2 verFN3 verFN4 verPN1 verPN2 verPN3 verPN4)
+ if (MSVC)
+ # Create project-specific version strings
+ inherit_value ("winver_${verProject}_FileVersionBinary" "${verFN1},${verFN2},${verFN3},${verFN4}")
+ inherit_value ("winver_${verProject}_ProductVersionBinary" "${verPN1},${verPN2},${verPN3},${verPN4}")
+ inherit_value ("winver_${verProject}_FileVersionString" "${verFN1}, ${verFN2}, ${verFN3}, ${verFN4}")
+ inherit_value ("winver_${verProject}_ProductVersionString" "${verPN1}, ${verPN2}, ${verPN3}, ${verPN4}")
+ inherit_value ("winver_${verProject}_FileDescription" "${winver_PACKAGE_NAME}-${verProject} ${verProjectType}")
+ inherit_value ("winver_${verProject}_LegalCopyright" "${winver_LEGAL_COPYRIGHT}")
+ inherit_value ("winver_${verProject}_InternalName" "${verProject}")
+ inherit_value ("winver_${verProject}_OriginalFilename" "${verProject}.${verProjectFileExt}")
+ inherit_value ("winver_${verProject}_ProductName" "${winver_DESCRIPTION_SUMMARY}")
+
+ # Create strings to be substituted into the template file
+ set ("winverFileVersionBinary" "${winver_${verProject}_FileVersionBinary}")
+ set ("winverProductVersionBinary" "${winver_${verProject}_ProductVersionBinary}")
+ set ("winverFileVersionString" "${winver_${verProject}_FileVersionString}")
+ set ("winverProductVersionString" "${winver_${verProject}_ProductVersionString}")
+ set ("winverFileDescription" "${winver_${verProject}_FileDescription}")
+ set ("winverLegalCopyright" "${winver_${verProject}_LegalCopyright}")
+ set ("winverInternalName" "${winver_${verProject}_InternalName}")
+ set ("winverOriginalFilename" "${winver_${verProject}_OriginalFilename}")
+ set ("winverProductName" "${winver_${verProject}_ProductName}")
+
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/windows/resources/template-resource.rc
+ ${CMAKE_CURRENT_BINARY_DIR}/windows/resources/${verProject}-resource.rc)
+ set (${verProject}_SOURCES
+ ${${verProject}_SOURCES}
+ ${CMAKE_CURRENT_BINARY_DIR}/windows/resources/${verProject}-resource.rc
+ )
+ endif (MSVC)
+ENDMACRO (add_msvc_version_full)
+
+#
+# If compiler is Visual Studio then create a "version resource" for the project.
+# Use this call to accept file override version settings or
+# inherited CPACK_PACKAGE_VERSION version settings.
+#
+# Sample: add_msvc_version (qpidcommon library dll)
+#
+MACRO (add_msvc_version verProject verProjectType verProjectFileExt)
+ if (MSVC)
+ add_msvc_version_full (${verProject}
+ ${verProjectType}
+ ${verProjectFileExt}
+ ${winver_FILE_VERSION_N1}
+ ${winver_FILE_VERSION_N2}
+ ${winver_FILE_VERSION_N3}
+ ${winver_FILE_VERSION_N4}
+ ${winver_PRODUCT_VERSION_N1}
+ ${winver_PRODUCT_VERSION_N2}
+ ${winver_PRODUCT_VERSION_N3}
+ ${winver_PRODUCT_VERSION_N4})
+ endif (MSVC)
+ENDMACRO (add_msvc_version)
+
+#
+# Install optional windows version settings. Override variables are specified in a file.
+#
+include (./CMakeWinVersions.cmake OPTIONAL)
+
+#
+# Inherit global windows version settings from CPACK settings.
+#
+inherit_value ("winver_PACKAGE_NAME" "${CPACK_PACKAGE_NAME}")
+inherit_value ("winver_DESCRIPTION_SUMMARY" "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}")
+inherit_value ("winver_FILE_VERSION_N1" "${CPACK_PACKAGE_VERSION_MAJOR}")
+inherit_value ("winver_FILE_VERSION_N2" "${CPACK_PACKAGE_VERSION_MINOR}")
+inherit_value ("winver_FILE_VERSION_N3" "${CPACK_PACKAGE_VERSION_PATCH}")
+inherit_value ("winver_FILE_VERSION_N4" "1")
+inherit_value ("winver_PRODUCT_VERSION_N1" "${winver_FILE_VERSION_N1}")
+inherit_value ("winver_PRODUCT_VERSION_N2" "${winver_FILE_VERSION_N2}")
+inherit_value ("winver_PRODUCT_VERSION_N3" "${winver_FILE_VERSION_N3}")
+inherit_value ("winver_PRODUCT_VERSION_N4" "${winver_FILE_VERSION_N4}")
+inherit_value ("winver_LEGAL_COPYRIGHT" "")
diff --git a/qpid/cpp/src/tests/CMakeLists.txt b/qpid/cpp/src/tests/CMakeLists.txt
index 20f98204a4..d2e6c7dd13 100644
--- a/qpid/cpp/src/tests/CMakeLists.txt
+++ b/qpid/cpp/src/tests/CMakeLists.txt
@@ -37,11 +37,6 @@ if (MSVC)
add_definitions( /wd4275 /wd4503 /D_CRT_SECURE_NO_WARNINGS)
endif (MSVC)
-# Macro to make it easier to remember where the tests are built
-macro(remember_location testname)
- set (${testname}_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/${testname}${CMAKE_EXECUTABLE_SUFFIX})
-endmacro(remember_location)
-
# If we're using GCC allow variadic macros (even though they're c99 not c++01)
if (CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-Wno-variadic-macros)
@@ -62,11 +57,9 @@ endif (CMAKE_SYSTEM_NAME STREQUAL Windows)
# Some generally useful utilities that just happen to be built in the test area
add_executable (qpid-receive qpid-receive.cpp Statistics.cpp ${platform_test_additions})
target_link_libraries (qpid-receive qpidmessaging qpidtypes qpidcommon)
-remember_location(qpid-receive)
add_executable (qpid-send qpid-send.cpp Statistics.cpp ${platform_test_additions})
target_link_libraries (qpid-send qpidmessaging qpidtypes qpidcommon)
-remember_location(qpid-send)
install (TARGETS
qpid-receive qpid-send
@@ -74,45 +67,35 @@ install (TARGETS
add_executable (qpid-perftest qpid-perftest.cpp ${platform_test_additions})
target_link_libraries (qpid-perftest qpidclient qpidcommon ${Boost_PROGRAM_OPTIONS_LIBRARY})
-remember_location(qpid-perftest)
add_executable (qpid-latency-test qpid-latency-test.cpp ${platform_test_additions})
target_link_libraries (qpid-latency-test qpidclient qpidcommon)
-remember_location(qpid-latency-test)
add_executable (qpid-client-test qpid-client-test.cpp ${platform_test_additions})
target_link_libraries (qpid-client-test qpidclient qpidcommon)
-remember_location(qpid-client-test)
add_executable (qpid-ping qpid-ping.cpp ${platform_test_additions})
target_link_libraries (qpid-ping qpidmessaging qpidtypes qpidcommon)
-remember_location(qpid-ping)
add_executable (qpid-topic-listener qpid-topic-listener.cpp ${platform_test_additions})
target_link_libraries (qpid-topic-listener qpidclient qpidcommon)
-remember_location(qpid-topic-listener)
add_executable (qpid-topic-publisher qpid-topic-publisher.cpp ${platform_test_additions})
target_link_libraries (qpid-topic-publisher qpidclient qpidcommon)
-remember_location(qpid-topic-publisher)
add_executable (receiver receiver.cpp ${platform_test_additions})
target_link_libraries (receiver qpidclient qpidcommon)
-remember_location(receiver)
# This is bizarre - using both messaging and client libraries
add_executable (sender sender.cpp Statistics.cpp ${platform_test_additions})
target_link_libraries (sender qpidmessaging qpidtypes qpidclient qpidcommon)
-remember_location(sender)
add_executable (qpid-txtest qpid-txtest.cpp ${platform_test_additions})
target_link_libraries (qpid-txtest qpidclient qpidcommon qpidtypes)
#qpid_txtest_SOURCES=qpid-txtest.cpp TestOptions.h ConnectionOptions.h
-remember_location(qpid-txtest)
add_executable (qpid-txtest2 qpid-txtest2.cpp ${platform_test_additions})
target_link_libraries (qpid-txtest2 qpidmessaging qpidtypes qpidcommon)
-remember_location(qpid-txtest2)
install (TARGETS
qpid-perftest qpid-latency-test qpid-client-test
@@ -240,9 +223,8 @@ target_link_libraries (unit_test
${qpid_test_boost_libs}
qpidmessaging qpidtypes qpidbroker qpidclient qpidcommon)
set_target_properties (unit_test PROPERTIES COMPILE_DEFINITIONS _IN_QPID_BROKER)
-remember_location(unit_test)
-add_test (unit_test ${test_wrap} -boostTest -- ${unit_test_LOCATION})
+add_test (NAME unit_test COMMAND ${test_wrap} -boostTest -- $<TARGET_FILE:unit_test>)
endif (BUILD_TESTING_UNITTESTS)
@@ -263,55 +245,42 @@ endif (BUILD_SASL)
#
add_executable (echotest echotest.cpp ${platform_test_additions})
target_link_libraries (echotest qpidclient qpidcommon)
-remember_location(echotest)
add_executable (publish publish.cpp ${platform_test_additions})
target_link_libraries (publish qpidclient qpidcommon)
-remember_location(publish)
add_executable (consume consume.cpp ${platform_test_additions})
target_link_libraries (consume qpidclient qpidcommon)
-remember_location(consume)
add_executable (header_test header_test.cpp ${platform_test_additions})
target_link_libraries (header_test qpidclient qpidcommon)
-remember_location(header_test)
add_executable (declare_queues declare_queues.cpp ${platform_test_additions})
target_link_libraries (declare_queues qpidclient qpidcommon)
-remember_location(declare_queues)
add_executable (replaying_sender replaying_sender.cpp ${platform_test_additions})
target_link_libraries (replaying_sender qpidclient qpidcommon)
-remember_location(replaying_sender)
add_executable (resuming_receiver resuming_receiver.cpp ${platform_test_additions})
target_link_libraries (resuming_receiver qpidclient qpidcommon)
-remember_location(resuming_receiver)
add_executable (txshift txshift.cpp ${platform_test_additions})
target_link_libraries (txshift qpidclient qpidcommon)
-remember_location(txshift)
add_executable (txjob txjob.cpp ${platform_test_additions})
target_link_libraries (txjob qpidclient qpidcommon)
-remember_location(txjob)
add_executable (datagen datagen.cpp ${platform_test_additions})
target_link_libraries (datagen qpidclient qpidcommon)
-remember_location(datagen)
add_executable (msg_group_test msg_group_test.cpp ${platform_test_additions})
target_link_libraries (msg_group_test qpidmessaging qpidtypes qpidcommon)
-remember_location(msg_group_test)
add_executable (ha_test_max_queues ha_test_max_queues.cpp ${platform_test_additions})
target_link_libraries (ha_test_max_queues qpidclient qpidcommon)
-remember_location(ha_test_max_queues)
if (BUILD_SASL)
add_executable (sasl_version sasl_version.cpp ${platform_test_additions})
- remember_location(sasl_version)
endif (BUILD_SASL)
set (python_src ${CMAKE_SOURCE_DIR}/../python)
@@ -338,27 +307,27 @@ if (EXISTS ${python_src})
endif (EXISTS ${python_src})
if (BUILD_SASL)
- add_test (sasl_fed ${test_wrap} -- ${CMAKE_CURRENT_SOURCE_DIR}/sasl_fed${test_script_suffix})
- add_test (sasl_fed_ex_dynamic ${test_wrap} -- ${CMAKE_CURRENT_SOURCE_DIR}/sasl_fed_ex${test_script_suffix} dynamic)
- add_test (sasl_fed_ex_link ${test_wrap} -- ${CMAKE_CURRENT_SOURCE_DIR}/sasl_fed_ex${test_script_suffix} link)
- add_test (sasl_fed_ex_queue ${test_wrap} -- ${CMAKE_CURRENT_SOURCE_DIR}/sasl_fed_ex${test_script_suffix} queue)
- add_test (sasl_fed_ex_route ${test_wrap} -- ${CMAKE_CURRENT_SOURCE_DIR}/sasl_fed_ex${test_script_suffix} route)
- add_test (sasl_no_dir ${test_wrap} -- ${CMAKE_CURRENT_SOURCE_DIR}/sasl_no_dir${test_script_suffix})
+ add_test (NAME sasl_fed COMMAND ${test_wrap} -- ${CMAKE_CURRENT_SOURCE_DIR}/sasl_fed${test_script_suffix})
+ add_test (NAME sasl_fed_ex_dynamic COMMAND ${test_wrap} -- ${CMAKE_CURRENT_SOURCE_DIR}/sasl_fed_ex${test_script_suffix} dynamic)
+ add_test (NAME sasl_fed_ex_link COMMAND ${test_wrap} -- ${CMAKE_CURRENT_SOURCE_DIR}/sasl_fed_ex${test_script_suffix} link)
+ add_test (NAME sasl_fed_ex_queue COMMAND ${test_wrap} -- ${CMAKE_CURRENT_SOURCE_DIR}/sasl_fed_ex${test_script_suffix} queue)
+ add_test (NAME sasl_fed_ex_route COMMAND ${test_wrap} -- ${CMAKE_CURRENT_SOURCE_DIR}/sasl_fed_ex${test_script_suffix} route)
+ add_test (NAME sasl_no_dir COMMAND ${test_wrap} -- ${CMAKE_CURRENT_SOURCE_DIR}/sasl_no_dir${test_script_suffix})
if (BUILD_SSL)
- add_test(ssl_test ${test_wrap} -- ${CMAKE_CURRENT_SOURCE_DIR}/ssl_test${test_script_suffix})
+ add_test(NAME ssl_test COMMAND ${test_wrap} -- ${CMAKE_CURRENT_SOURCE_DIR}/ssl_test${test_script_suffix})
endif (BUILD_SSL)
endif (BUILD_SASL)
-add_test (qpid-client-test ${test_wrap} -startBroker -- ${qpid-client-test_LOCATION})
-add_test (quick_perftest ${test_wrap} -startBroker -- ${qpid-perftest_LOCATION} --summary --count 100)
-add_test (quick_topictest ${test_wrap} -startBroker -- ${CMAKE_CURRENT_SOURCE_DIR}/quick_topictest${test_script_suffix})
-add_test (quick_txtest ${test_wrap} -startBroker -- ${qpid-txtest_LOCATION} --queues 4 --tx-count 10 --quiet)
-add_test (quick_txtest2 ${test_wrap} -startBroker -- ${qpid-txtest2_LOCATION} --queues 4 --tx-count 10 --quiet)
-add_test (msg_group_tests ${test_wrap} -startBroker -- ${CMAKE_CURRENT_SOURCE_DIR}/run_msg_group_tests${test_script_suffix})
-add_test (run_header_test ${test_wrap} -startBroker -- ${CMAKE_CURRENT_SOURCE_DIR}/run_header_test${test_script_suffix})
-add_test (python_tests ${test_wrap} -startBroker -- ${CMAKE_CURRENT_SOURCE_DIR}/python_tests${test_script_suffix})
+add_test (NAME qpid-client-test COMMAND ${test_wrap} -startBroker -- $<TARGET_FILE:qpid-client-test>)
+add_test (NAME quick_perftest COMMAND ${test_wrap} -startBroker -- $<TARGET_FILE:qpid-perftest> --summary --count 100)
+add_test (NAME quick_topictest COMMAND ${test_wrap} -startBroker -- ${CMAKE_CURRENT_SOURCE_DIR}/quick_topictest${test_script_suffix})
+add_test (NAME quick_txtest COMMAND ${test_wrap} -startBroker -- $<TARGET_FILE:qpid-txtest> --queues 4 --tx-count 10 --quiet)
+add_test (NAME quick_txtest2 COMMAND ${test_wrap} -startBroker -- $<TARGET_FILE:qpid-txtest2> --queues 4 --tx-count 10 --quiet)
+add_test (NAME msg_group_tests COMMAND ${test_wrap} -startBroker -- ${CMAKE_CURRENT_SOURCE_DIR}/run_msg_group_tests${test_script_suffix})
+add_test (NAME run_header_test COMMAND ${test_wrap} -startBroker -- ${CMAKE_CURRENT_SOURCE_DIR}/run_header_test${test_script_suffix})
+add_test (NAME python_tests COMMAND ${test_wrap} -startBroker -- ${CMAKE_CURRENT_SOURCE_DIR}/python_tests${test_script_suffix})
if (NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
# paged queue not yet implemented for windows
- add_test (paged_queue_tests ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/run_paged_queue_tests${test_script_suffix})
+ add_test (NAME paged_queue_tests COMMAND ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/run_paged_queue_tests${test_script_suffix})
endif (NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
if (BUILD_AMQP)
diff --git a/qpid/cpp/src/tests/legacystore/CMakeLists.txt b/qpid/cpp/src/tests/legacystore/CMakeLists.txt
index 5527f23255..9f6f6b7171 100644
--- a/qpid/cpp/src/tests/legacystore/CMakeLists.txt
+++ b/qpid/cpp/src/tests/legacystore/CMakeLists.txt
@@ -53,8 +53,7 @@ target_link_libraries (${testname}
if ("${ARGV1}" STREQUAL "LONG")
set_target_properties(${testname} PROPERTIES COMPILE_DEFINITIONS LONG_TEST)
endif ()
-remember_location(${testname})
-add_test (${testname} ${test_wrap} -boostTest -- ${${testname}_LOCATION})
+add_test (NAME ${testname} COMMAND ${test_wrap} -boostTest -- $<TARGET_FILE:${testname}>)
unset (testname)
ENDMACRO (define_journal_test)