Skip to content

Commit

Permalink
Convert to do default find_packaage() but respond to std TriBITS TPL …
Browse files Browse the repository at this point in the history
…vars (TriBITSPub#156)

This now matches the standard behavior defined in the TriBITS Developers
Guide.

The FIND_PACKAGE(CGNS) call was made optional as per the standard.  But that
should be okay because if that fails, then if the standard TriBITS TPL find
fails, then the TPL find will bomb out.
  • Loading branch information
bartlettroscoe committed Feb 24, 2017
1 parent 9168b04 commit a5f7169
Showing 1 changed file with 39 additions and 8 deletions.
47 changes: 39 additions & 8 deletions tribits/common_tpls/FindTPLCGNS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,45 @@
# ************************************************************************
# @HEADER

SET(CMAKE_MODULE_PATH
"${CMAKE_MODULE_PATH}"
"${CMAKE_CURRENT_LIST_DIR}/find_modules"
"${CMAKE_CURRENT_LIST_DIR}/utils"
)
#
# First, set up the variables for the (backward-compatible) TriBITS way of
# finding Netcdf. These are used in case FIND_PACKAGE(NetCDF ...) is not
# called or does not find NetCDF. Also, these variables need to be non-null
# in order to trigger the right behavior in the function
# TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES().
#
SET(REQUIRED_HEADERS cgnslib.h)
SET(REQUIRED_LIBS_NAMES cgns)

#
# Second, search for Netcdf components (if allowed) using the standard
# FIND_PACKAGE(CGNS ...).
#
TRIBITS_TPL_ALLOW_PRE_FIND_PACKAGE(CGNS CGNS_ALLOW_PREFIND)
IF (CGNS_ALLOW_PREFIND)

find_package(CGNS REQUIRED)
MESSAGE("-- Using FIND_PACKAGE(CGNS ...) ...")

SET(CMAKE_MODULE_PATH
"${CMAKE_MODULE_PATH}"
"${CMAKE_CURRENT_LIST_DIR}/find_modules"
"${CMAKE_CURRENT_LIST_DIR}/utils"
)

find_package(CGNS)

IF (CGNS_FOUND)
set(TPL_CGNS_LIBRARIES ${CGNS_LIBRARIES} CACHE PATH
"List of semi-colon seprated (full) paths to the CGNS libraries")
set(TPL_CGNS_INCLUDE_DIRS ${CGNS_INCLUDE_DIRS} CACHE PATH
"List of semi-colon seprated list of directories containing CGNS header files")
ENDIF()

ENDIF()

#
# Third, call TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES()
#
TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES( CGNS
REQUIRED_HEADERS cgnslib.h
REQUIRED_LIBS_NAMES "cgns")
REQUIRED_HEADERS ${REQUIRED_HEADERS}
REQUIRED_LIBS_NAMES ${REQUIRED_LIBS_NAMES})

0 comments on commit a5f7169

Please sign in to comment.