Skip to content

Commit

Permalink
Fix Missing ACE with OPENDDS_ACE_TAO_SRC
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
iguessthislldo committed Apr 26, 2024
1 parent 9a1f1f6 commit c028b45
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 23 deletions.
6 changes: 0 additions & 6 deletions cmake/ace_group.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions cmake/build_ace_tao.cmake
Original file line number Diff line number Diff line change
@@ -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}"
Expand Down
3 changes: 0 additions & 3 deletions cmake/get_ace_tao.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
17 changes: 13 additions & 4 deletions cmake/import_common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 0 additions & 6 deletions cmake/tao_group.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions docs/news.d/cmake-ace-tao-src.rst
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit c028b45

Please sign in to comment.