Skip to content

Commit

Permalink
Remove unnecessary export config lines, add logic to properly compile…
Browse files Browse the repository at this point in the history
… and export LLNLSpheral when dev build is turned on
  • Loading branch information
ldowen committed Sep 16, 2024
1 parent 53e3eb0 commit 7ba9dbd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
10 changes: 0 additions & 10 deletions cmake/spheral_cxx-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,6 @@ if(NOT SPHERAL_FOUND)
endif()
endif()
include("${SPHERAL_CXX_INSTALL_PREFIX}/lib/cmake/spheral_cxx-targets.cmake")
if(@ENABLE_DEV_BUILD)
set(SPHERAL_LIBS @SPHERAL_OBJ_LIBS@)
add_library(Spheral_CXX INTERFACE IMPORTED)
foreach(_lib ${SPHERAL_LIBS})
set_property(TARGET Spheral_CXX
PROPERTY INTERFACE_LINK_LIBRARIES
${_lib}
APPEND)
endforeach()
endif()
set_property(TARGET Spheral_CXX
APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${SPHERAL_CXX_INCLUDE_DIRS})
Expand Down
20 changes: 15 additions & 5 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,25 @@ foreach(_package ${_packages})
add_subdirectory(${_package})
endforeach()

# Retrieve the global list populated in spheral_obj_add_library
get_property(SPHERAL_OBJ_LIBS GLOBAL PROPERTY SPHERAL_OBJ_LIBS)
if(NOT ENABLE_DEV_BUILD)
# For dev builds, we must call LLNLSpheralInstallObjs.cmake
# to ensure LLNLSpheral libraries are added to the Spheral_CXX
# target
if(ENABLE_DEV_BUILD)
# This calls LLNLSpheralInstallObjs.cmake
if(EXISTS ${EXTERNAL_SPHERAL_OBJ_CMAKE})
include(${EXTERNAL_SPHERAL_OBJ_CMAKE})
endif()
else()
set(CXX_sources spheralCXX.cc)
endif()
# Retrieve the global list populated in spheral_obj_add_library
get_property(SPHERAL_OBJ_LIBS GLOBAL PROPERTY SPHERAL_OBJ_LIBS)
# Must use quotes when passing lists as inputs for functions
spheral_add_cxx_library(CXX "${SPHERAL_OBJ_LIBS}")

# This calls LLNLSpheralInstallObjs.cmake
if(EXISTS ${EXTERNAL_SPHERAL_OBJ_CMAKE})
include(${EXTERNAL_SPHERAL_OBJ_CMAKE})
if(NOT ENABLE_DEV_BUILD)
if(EXISTS ${EXTERNAL_SPHERAL_OBJ_CMAKE})
include(${EXTERNAL_SPHERAL_OBJ_CMAKE})
endif()
endif()

0 comments on commit 7ba9dbd

Please sign in to comment.