Skip to content

Commit

Permalink
Initialise WITH_SYSTEM_RPN properly so that its cache is correctly set
Browse files Browse the repository at this point in the history
  • Loading branch information
chantal-pic committed May 22, 2024
1 parent 371ab36 commit 7401a45
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
set(WITH_SYSTEM_RPN FALSE CACHE BOOL "Control whether to use installed RPN-SI libs")
if ($ENV{WITH_SYSTEM_RPN})
message(STATUS "(EC) Using RPN-SI installed libraries = $ENV{WITH_SYSTEM_RPN}")
if(DEFINED ENV{WITH_SYSTEM_RPN})
set(WITH_SYSTEM_RPN $ENV{WITH_SYSTEM_RPN} CACHE BOOL "Control whether to use installed RPN-SI libs")
else()
message(STATUS "(EC) Using RPN-SI installed libraries = ${WITH_SYSTEM_RPN}")
set(WITH_SYSTEM_RPN FALSE CACHE BOOL "Control whether to use installed RPN-SI libs")
endif()
message(STATUS "(EC) Using RPN-SI installed libraries = ${WITH_SYSTEM_RPN}")

# Use installed RPN libraries (WITH_SYSTEM_RPN=TRUE)
if ((WITH_SYSTEM_RPN) OR (CACHE WITH_SYSTEM_RPN) OR ($ENV{WITH_SYSTEM_RPN}))
if(WITH_SYSTEM_RPN)
find_package(rmn ${rmn_REQ_VERSION} COMPONENTS static REQUIRED)
find_package(tdpack ${tdpack_REQ_VERSION} COMPONENTS static REQUIRED)
find_package(rpncomm ${rpncomm_REQ_VERSION} REQUIRED)
Expand Down Expand Up @@ -50,6 +50,17 @@ if (EXISTS ${CMAKE_SOURCE_DIR}/src/rpnphy/CMakeLists.txt)
set(phy_VERSION ${rpnphy_VERSION} CACHE STRING "rpnphy version")
endif()

set(WITH_MACH FALSE CACHE BOOL "Control whether to compile with mach")
if ((WITH_MACH) OR (CACHE WITH_MACH) OR ($ENV{WITH_MACH}))
# Add gem-mach source files, if source directory exists
if (EXISTS ${CMAKE_SOURCE_DIR}/src/mach/CMakeLists.txt)
set(chm_LIBRARIES mach CACHE STRING "mach chemistry library" FORCE)
add_subdirectory(mach mach)
else()
message(ERROR " -- (EC) You set WITH_MACH=TRUE, but no mach directory was found!")
endif()
endif()

if (EXISTS ${CMAKE_SOURCE_DIR}/src/gemdyn/CMakeLists.txt)
add_subdirectory(gemdyn gemdyn)
set(dyn_VERSION ${gemdyn_VERSION} CACHE STRING "gemdyn version")
Expand All @@ -58,7 +69,7 @@ endif()
add_subdirectory(gem gem)

# Add those tools only for external users, or if WITH_SYSTEM_RPN is FALSE
if ((NOT DEFINED ENV{EC_ARCH} ) OR (NOT ((WITH_SYSTEM_RPN) OR (CACHE WITH_SYSTEM_RPN) OR ($ENV{WITH_SYSTEM_RPN}))))
if((NOT DEFINED ENV{EC_ARCH}) OR (NOT WITH_SYSTEM_RPN))
add_subdirectory(rpn-si/cclargs cclargs)
add_subdirectory(rpn-si/fst-tools fst-tools)
add_subdirectory(rpn-si/filetype filetype)
Expand Down

0 comments on commit 7401a45

Please sign in to comment.