pism icon indicating copy to clipboard operation
pism copied to clipboard

FindPISM.cmake?

Open citibeth opened this issue 12 years ago • 1 comments

Is there a FindPISM.cmake, or something with equivalent functionality?

citibeth avatar Feb 14 '14 18:02 citibeth

Not yet.

Could you describe the functionality you need?

ckhroulev avatar Feb 14 '14 18:02 ckhroulev

In PISM's current dev branch and upcoming releases: use pkg-config to link with PISM's library code.

  1. Install PISM to PISM_PREFIX
  2. Add $PISM_PREFIX/lib/pkgconfig to PKG_CONFIG_PATH
  3. Use pkg-config --cflags pism and pkg-config --libs pism to get compiler and linker flags.

With CMake >= 3.7, follow steps 1 and 2, then use this:

find_package(PkgConfig REQUIRED)

pkg_search_module(PISM REQUIRED IMPORTED_TARGET pism)
if (PISM_FOUND)
  message(STATUS
    "Found PISM: ${PISM_PREFIX} (found version \"${PISM_VERSION}\")")
endif()

target_link_libraries(some_target PkgConfig::PISM)

ckhroulev avatar Jul 17 '23 19:07 ckhroulev