From c028b45bfb3756bb56d4f29315aa5be491910435 Mon Sep 17 00:00:00 2001 From: Fred Hornsey Date: Thu, 25 Apr 2024 19:44:56 -0500 Subject: [PATCH] Fix Missing ACE with OPENDDS_ACE_TAO_SRC The ACE and TAO library targets from MPC might be called `ACE-target` and `TAO-target` depending on if they're in directories of the same name. It should be trivial to predict this, but the path logic for this in MPC seems buggy and might not prepend `-target` when `OPENDDS_ACE_TAO_SRC` is outside of the build directory, so we're just going to check both for all targets. --- cmake/ace_group.cmake | 6 ------ cmake/build_ace_tao.cmake | 4 ---- cmake/get_ace_tao.cmake | 3 --- cmake/import_common.cmake | 17 +++++++++++++---- cmake/tao_group.cmake | 6 ------ docs/news.d/cmake-ace-tao-src.rst | 7 +++++++ 6 files changed, 20 insertions(+), 23 deletions(-) create mode 100644 docs/news.d/cmake-ace-tao-src.rst diff --git a/cmake/ace_group.cmake b/cmake/ace_group.cmake index 6105b1b9733..77f0c55a65d 100644 --- a/cmake/ace_group.cmake +++ b/cmake/ace_group.cmake @@ -12,13 +12,7 @@ include("${CMAKE_CURRENT_LIST_DIR}/import_common.cmake") _opendds_group(ACE DEFAULT_REQUIRED ACE::ACE) -if(_OPENDDS_ACE_MPC_NAME_IS_ACE_TARGET) - set(_mpc_name ACE-target) -else() - set(_mpc_name ACE) -endif() _opendds_group_lib(ACE - MPC_NAME "${_mpc_name}" DEPENDS Threads::Threads ) _opendds_group_lib(XML_Utils diff --git a/cmake/build_ace_tao.cmake b/cmake/build_ace_tao.cmake index c011484d426..276dfe0cc6a 100644 --- a/cmake/build_ace_tao.cmake +++ b/cmake/build_ace_tao.cmake @@ -1,9 +1,5 @@ include(ExternalProject) -if(_OPENDDS_MPC_TYPE STREQUAL gnuace) - set(_OPENDDS_TAO_MPC_NAME_IS_TAO_TARGET TRUE CACHE INTERNAL "") -endif() - if(OPENDDS_JUST_BUILD_HOST_TOOLS) set(ws "${OPENDDS_BUILD_DIR}/host-tools.mwc") file(WRITE "${ws}" diff --git a/cmake/get_ace_tao.cmake b/cmake/get_ace_tao.cmake index fb13d58d26d..54b3b9b187e 100644 --- a/cmake/get_ace_tao.cmake +++ b/cmake/get_ace_tao.cmake @@ -133,9 +133,6 @@ if(EXISTS "${OPENDDS_ACE_TAO_SRC}/ace/Version.h") set(OPENDDS_ACE "${OPENDDS_ACE_TAO_SRC}" CACHE INTERNAL "") elseif(EXISTS "${OPENDDS_ACE_TAO_SRC}/ACE/ace/Version.h") set(OPENDDS_ACE "${OPENDDS_ACE_TAO_SRC}/ACE" CACHE INTERNAL "") - if(_OPENDDS_MPC_TYPE STREQUAL gnuace) - set(_OPENDDS_ACE_MPC_NAME_IS_ACE_TARGET TRUE CACHE INTERNAL "") - endif() else() message(FATAL_ERROR "Can't find ace/Version.h in ${OPENDDS_ACE}") endif() diff --git a/cmake/import_common.cmake b/cmake/import_common.cmake index 41588915b1c..453bc880399 100644 --- a/cmake/import_common.cmake +++ b/cmake/import_common.cmake @@ -104,11 +104,20 @@ endfunction() function(_opendds_find_in_mpc_projects found_var path_var mpc_projects mpc_name config) string(JSON mpc_project ERROR_VARIABLE err GET "${mpc_projects}" "${mpc_name}") if(NOT mpc_project) - set(${found_var} FALSE CACHE INTERNAL "" FORCE) - if(debug) - message(STATUS "lib ${target} (${mpc_name}) not in MPC projects") + # The ACE and TAO libraries targets from MPC might be called ACE-target and + # TAO-target depending on if they're in directories of the same name. It + # should be trivial to predict this, but the path logic for this in MPC + # seems buggy and might not prepend -target when OPENDDS_ACE_TAO_SRC is + # outside of the build directory, so we're just going to check both for all + # targets. + string(JSON mpc_project ERROR_VARIABLE err GET "${mpc_projects}" "${mpc_name}-target") + if(NOT mpc_project) + set(${found_var} FALSE CACHE INTERNAL "" FORCE) + if(debug) + message(STATUS "lib ${target} (${mpc_name} or ${mpc_name}-target) not in MPC projects") + endif() + return() endif() - return() endif() string(JSON configs ERROR_VARIABLE err GET "${mpc_project}" "configs") if(config AND configs) diff --git a/cmake/tao_group.cmake b/cmake/tao_group.cmake index 7260988bd30..4d9b0494919 100644 --- a/cmake/tao_group.cmake +++ b/cmake/tao_group.cmake @@ -12,13 +12,7 @@ include("${CMAKE_CURRENT_LIST_DIR}/import_common.cmake") _opendds_group(TAO DEFAULT_REQUIRED TAO::TAO TAO::tao_idl) -if(_OPENDDS_TAO_MPC_NAME_IS_TAO_TARGET) - set(_mpc_name TAO-target) -else() - set(_mpc_name TAO) -endif() _opendds_group_lib(TAO - MPC_NAME "${_mpc_name}" DEPENDS ACE::ACE ) _opendds_group_lib(IDL_FE diff --git a/docs/news.d/cmake-ace-tao-src.rst b/docs/news.d/cmake-ace-tao-src.rst new file mode 100644 index 00000000000..6ac106d57e9 --- /dev/null +++ b/docs/news.d/cmake-ace-tao-src.rst @@ -0,0 +1,7 @@ +.. news-prs: 4604 + +.. news-start-section: Platform Support and Dependencies +.. news-start-section: Building with CMake +- Fixed CMake saying it's missing the ACE library when using :cmake:var:`OPENDDS_ACE_TAO_SRC` with an ACE/TAO outside of the build directory. +.. news-end-section +.. news-end-section