Skip to content

Commit a03d58c

Browse files
committed
Updating build style for libmesh.
1 parent e79932e commit a03d58c

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

CMakeLists.txt

+1-5
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ else()
7171
#===============================================================================
7272
if(libmesh)
7373
find_package(LIBMESH REQUIRED)
74-
set(LIBMESH_LIBRARIES mesh_devel timpi_devel netcdf)
75-
set(LIBMESH_INCLUDE_DIRS "${LIBMESH}/../include/")
76-
link_directories(${LIBMESH})
7774
endif()
7875

7976
#===============================================================================
@@ -377,6 +374,7 @@ target_include_directories(libopenmc
377374
$<INSTALL_INTERFACE:include>
378375
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
379376
${HDF5_INCLUDE_DIRS}
377+
${LIBMESH_INCLUDE_DIRECTORIES}
380378
)
381379

382380
# Set compile flags
@@ -415,9 +413,7 @@ if(dagmc)
415413
endif()
416414

417415
if(libmesh)
418-
target_compile_definitions(libopenmc PRIVATE LIBMESH)
419416
target_link_libraries(libopenmc ${LIBMESH_LIBRARIES})
420-
target_include_directories(libopenmc PRIVATE ${LIBMESH_INCLUDE_DIRS})
421417
endif()
422418

423419
#===============================================================================

cmake/Modules/FindLIBMESH.cmake

+6-7
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@
77
# LIBMESH_LIBRARIES - Link these to use LIBMESH
88
# LIBMESH_DEFINITIONS - Compiler switches required for using LIBMESH
99

10-
find_path(LIBMESH NAMES libmesh_opt.so
10+
find_path(LIBMESH_PC NAMES libmesh-opt.pc
1111
HINTS ${LIBMESH_ROOT} $ENV{LIBMESH_ROOT}
1212
PATHS ENV LD_LIBRARY_PATH
13-
PATH_SUFFIXES lib Lib
13+
PATH_SUFFIXES lib/pkgconfig pkgconfig
1414
NO_DEFAULT_PATH)
1515

16-
if(DEFINED LIBMESH)
17-
set(LIBMESH_FOUND TRUE)
18-
endif()
16+
include(FindPkgConfig)
17+
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${LIBMESH_PC}")
18+
pkg_check_modules(LIBMESH REQUIRED libmesh IMPORTED_TARGET)
1919

20-
21-
message(STATUS "Found LIBMESH in ${LIBMESH}")
20+
message(STATUS "Found LIBMESH in ${LIBMESH_PC}")

0 commit comments

Comments
 (0)