PROTON-1560: cmake BUILD_ONLY limit to selected bindings Only bindings in this list are built by default. Explicit BUILD_XXX=ON settings always take precendence. Defaults to all bindings.
Example: cmake -DBUILD_ONLY=ruby . Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/bbeb78ca Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/bbeb78ca Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/bbeb78ca Branch: refs/heads/master Commit: bbeb78caa04ce7897f15967f598d8f8e3a35f47f Parents: 213a78b Author: Alan Conway <[email protected]> Authored: Thu Sep 28 17:23:46 2017 -0400 Committer: Alan Conway <[email protected]> Committed: Thu Sep 28 17:36:02 2017 -0400 ---------------------------------------------------------------------- proton-c/CMakeLists.txt | 30 +++++++++++++++--------------- proton-c/bindings/CMakeLists.txt | 15 ++++++++++----- 2 files changed, 25 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/bbeb78ca/proton-c/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt index 9248068..cb05ce5 100644 --- a/proton-c/CMakeLists.txt +++ b/proton-c/CMakeLists.txt @@ -329,6 +329,21 @@ pn_absolute_install_dir(EXEC_PREFIX "." ${CMAKE_INSTALL_PREFIX}) pn_absolute_install_dir(LIBDIR ${LIB_INSTALL_DIR} ${CMAKE_INSTALL_PREFIX}) pn_absolute_install_dir(INCLUDEDIR ${INCLUDE_INSTALL_DIR} ${CMAKE_INSTALL_PREFIX}) +if (CMAKE_SYSTEM_NAME STREQUAL Windows) + # No change needed for windows already use correct separator + function(to_native_path path result) + file (TO_NATIVE_PATH "${path}" path) + set (${result} ${path} PARENT_SCOPE) + endfunction() +else (CMAKE_SYSTEM_NAME STREQUAL Windows) + # Just change ';'->':' + function(to_native_path path result) + file (TO_NATIVE_PATH "${path}" path) + string (REGEX REPLACE ";" ":" path "${path}") + set (${result} ${path} PARENT_SCOPE) + endfunction() +endif (CMAKE_SYSTEM_NAME STREQUAL Windows) + add_subdirectory(docs/api) add_subdirectory(../tests/tools/apps/c ../tests/tools/apps/c) @@ -717,21 +732,6 @@ install (FILES add_subdirectory(src/tests) -if (CMAKE_SYSTEM_NAME STREQUAL Windows) - # No change needed for windows already use correct separator - function(to_native_path path result) - file (TO_NATIVE_PATH "${path}" path) - set (${result} ${path} PARENT_SCOPE) - endfunction() -else (CMAKE_SYSTEM_NAME STREQUAL Windows) - # Just change ';'->':' - function(to_native_path path result) - file (TO_NATIVE_PATH "${path}" path) - string (REGEX REPLACE ";" ":" path "${path}") - set (${result} ${path} PARENT_SCOPE) - endfunction() -endif (CMAKE_SYSTEM_NAME STREQUAL Windows) - # python test: tests/python/proton-test if (BUILD_PYTHON) set (py_root "${pn_test_root}/python") http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/bbeb78ca/proton-c/bindings/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/proton-c/bindings/CMakeLists.txt b/proton-c/bindings/CMakeLists.txt index dd4c2c8..40944d9 100644 --- a/proton-c/bindings/CMakeLists.txt +++ b/proton-c/bindings/CMakeLists.txt @@ -102,15 +102,20 @@ if(SWIG_FOUND) endif() -# Shouldn't need to modify below here when adding new language binding + +set(BUILD_ONLY "${BINDINGS}" CACHE STRING + "Only bindings in this list are built by default. Explicit BUILD_XXX=ON settings take precendence") + foreach(BINDING ${BINDINGS}) string(TOUPPER ${BINDING} UBINDING) - # Check whether default was overridden - if (NOBUILD_${UBINDING}) - set ("DEFAULT_${UBINDING}" OFF) - endif () + list(FIND BUILD_ONLY ${BINDING} N) + if("NOBUILD_${UBINDING}" OR ( N EQUAL -1 ) ) # Over-ridden or not on the BUILD_ONLY list + set("DEFAULT_${UBINDING}" OFF) + endif() option("BUILD_${UBINDING}" "Build ${BINDING} language binding" ${DEFAULT_${UBINDING}}) if (BUILD_${UBINDING}) add_subdirectory(${BINDING}) endif () endforeach(BINDING) + +unset(BUILD_ONLY) # Only relevant to set initial defaults. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
