Repository: mesos Updated Branches: refs/heads/master 5d4328b92 -> bd5e874c2
CMake: Removed `MESOS_CPPFLAGS` variable. This was a magic variable that was used to add compiler definitions globally. Instead, global definitions are now added explicitly with `add_definitions`, and others with `target_compile_definitions`. Review: https://reviews.apache.org/r/62731/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/bd5e874c Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/bd5e874c Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/bd5e874c Branch: refs/heads/master Commit: bd5e874c22f0d16fc5494213d319065cf9107d0f Parents: 3f15ded Author: Andrew Schwartzmeyer <and...@schwartzmeyer.com> Authored: Mon Oct 2 14:33:52 2017 -0700 Committer: Joseph Wu <josep...@apache.org> Committed: Mon Oct 2 14:36:56 2017 -0700 ---------------------------------------------------------------------- cmake/CompilationConfigure.cmake | 20 ++++++-------------- src/CMakeLists.txt | 11 +++++++++++ 2 files changed, 17 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/bd5e874c/cmake/CompilationConfigure.cmake ---------------------------------------------------------------------- diff --git a/cmake/CompilationConfigure.cmake b/cmake/CompilationConfigure.cmake index e414406..a94cfa1 100644 --- a/cmake/CompilationConfigure.cmake +++ b/cmake/CompilationConfigure.cmake @@ -299,13 +299,13 @@ if (WIN32) # to give the build system fine-grained control over what code is #ifdef'd # out in the future. Using only flags defined by our build system to control # this logic is the clearest and most stable way of accomplishing this. - list(APPEND MESOS_CPPFLAGS -D__WINDOWS__) + add_definitions(-D__WINDOWS__) # Defines to disable warnings generated by Visual Studio when using # deprecated functions in CRT and the use of insecure functions in CRT. # TODO(dpravat): Once the entire codebase is changed to use secure CRT # functions, these defines should be removed. - list(APPEND MESOS_CPPFLAGS + add_definitions( -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS) @@ -331,14 +331,16 @@ endif () # and other general exploits that rely on deterministic offsets. set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) -list(APPEND MESOS_CPPFLAGS +# TODO(andschwa): Make these non-global. +add_definitions( -DPKGLIBEXECDIR="${PKG_LIBEXEC_INSTALL_DIR}" -DLIBDIR="${LIB_INSTALL_DIR}" -DVERSION="${PACKAGE_VERSION}" -DPKGDATADIR="${DATA_INSTALL_PREFIX}") if (ENABLE_SSL) - list(APPEND MESOS_CPPFLAGS -DUSE_SSL_SOCKET=1) + # TODO(andschwa): Make this non-global. + add_definitions(-DUSE_SSL_SOCKET=1) endif () # Calculate some build information. @@ -382,13 +384,3 @@ configure_file( "${CMAKE_SOURCE_DIR}/src/common/build_config.hpp.in" "${CMAKE_BINARY_DIR}/src/common/build_config.hpp" @ONLY) - -# NOTE: The quotes in these definitions are necessary. Without them, the -# preprocessor will interpret the symbols as (e.g.) int literals and uquoted -# identifiers, rather than the string values our code expects. -list(APPEND MESOS_CPPFLAGS - -DUSE_CMAKE_BUILD_CONFIG - -DBUILD_JAVA_JVM_LIBRARY="${JAVA_JVM_LIBRARY}") - -# TODO(hausdorff): (MESOS-5455) `BUILD_FLAGS` is currently a placeholder value. -add_definitions(${MESOS_CPPFLAGS} -DBUILD_FLAGS="") http://git-wip-us.apache.org/repos/asf/mesos/blob/bd5e874c/src/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f8d56ae..5677933 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -594,6 +594,17 @@ set_target_properties( VERSION ${MESOS_PACKAGE_VERSION} SOVERSION ${MESOS_PACKAGE_SOVERSION}) +# NOTE: The quotes in these definitions are necessary. Without them, the +# preprocessor will interpret the symbols as (e.g.) int literals and unquoted +# identifiers, rather than the string values our code expects. +target_compile_definitions( + mesos PUBLIC + USE_CMAKE_BUILD_CONFIG + BUILD_JAVA_JVM_LIBRARY="${JAVA_JVM_LIBRARY}" + + # TODO(andschwa): (MESOS-5455) `BUILD_FLAGS` is currently a placeholder value. + BUILD_FLAGS="") + target_include_directories( mesos PUBLIC ${MESOS_PUBLIC_INCLUDE_DIR}