diff --git a/CMakeLists.txt b/CMakeLists.txt index e4d81b2327..7c8ec5ff5b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,12 +66,12 @@ if(pugixml_FOUND) message(STATUS "Found pugixml: ${pugixml_DIR}") else() message(STATUS "Did not find pugixml, will use submodule instead") + #=============================================================================== # libMesh Unstructured Mesh Support #=============================================================================== if(libmesh) find_package(LIBMESH REQUIRED) - list(APPEND cxxflags ${LIBMESH_CFLAGS}) endif() #=============================================================================== @@ -389,9 +389,6 @@ endif() if (MPI_ENABLED) target_compile_definitions(libopenmc PUBLIC -DOPENMC_MPI) endif() -if (libmesh) - target_compile_definitions(libopenmc PRIVATE LIBMESH) -endif() # Set git SHA1 hash as a compile definition if(GIT_FOUND) @@ -416,11 +413,8 @@ if(dagmc) endif() if(libmesh) - if (debug) - target_link_libraries(libopenmc PkgConfig::LIBMESH_DEVEL) - else() - target_link_libraries(libopenmc PkgConfig::LIBMESH) - endif() + target_compile_definitions(libopenmc PRIVATE LIBMESH) + target_link_libraries(libopenmc PkgConfig::LIBMESH) endif() #=============================================================================== diff --git a/cmake/Modules/FindLIBMESH.cmake b/cmake/Modules/FindLIBMESH.cmake index 96ece4a0a8..2359f904d7 100644 --- a/cmake/Modules/FindLIBMESH.cmake +++ b/cmake/Modules/FindLIBMESH.cmake @@ -1,15 +1,12 @@ # Finds the libMesh installation using CMake's PkgConfig # module and creates a libmesh imported target -find_path(LIBMESH_PC NAMES libmesh-opt.pc - HINTS ${LIBMESH_DIR} $ENV{LIBMESH_ROOT} - PATHS ENV LD_LIBRARY_PATH - PATH_SUFFIXES lib/pkgconfig pkgconfig - NO_DEFAULT_PATH) - include(FindPkgConfig) set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${LIBMESH_PC}") pkg_check_modules(LIBMESH REQUIRED libmesh IMPORTED_TARGET) -pkg_check_modules(LIBMESH_DEVEL REQUIRED libmesh-devel IMPORTED_TARGET) -message(STATUS "Found LIBMESH in ${LIBMESH_PC}") +find_path(LIBMESH_PC NAMES libmesh.pc + HINTS ${LIBMESH_LIBDIR} + PATHS ENV LD_LIBRARY_PATH + PATH_SUFFIXES lib/pkgconfig pkgconfig + NO_DEFAULT_PATH)