Skip to content

Commit 9bb8555

Browse files
committed
Use find_package for GSL (it knows how to homebrew)
1 parent 45e44b8 commit 9bb8555

File tree

4 files changed

+6
-18
lines changed

4 files changed

+6
-18
lines changed

CMakeLists.txt

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ cmake_minimum_required(VERSION 2.8.10...3.26.0)
22

33
project(Base9 CXX C)
44

5-
list( APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" )
5+
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" )
66

77
set(CMAKE_REQUIRED_INCLUDES "/usr/local/include")
88

99
include(CheckIncludeFiles)
10-
1110
check_include_files (math.h HAS_MATH)
12-
check_include_files ("gsl/gsl_blas.h;gsl/gsl_math.h;gsl/gsl_eigen.h;gsl/gsl_statistics.h;gsl/gsl_linalg.h;gsl/gsl_spline.h;gsl/gsl_errno.h" HAS_GSL_BLAS)
1311
check_include_files (getopt.h HAS_GETOPT)
1412
check_include_files (unistd.h HAS_UNISTD)
1513

14+
find_package(GSL REQUIRED)
15+
1616
include(CheckFunctionExists)
1717
set(CMAKE_REQUIRED_LIBRARIES "m")
1818
check_function_exists (exp exp HAS_EXP)
@@ -119,18 +119,6 @@ MARK_AS_ADVANCED(
119119
#####################################
120120
# Project specific code starts here #
121121
#####################################
122-
find_library(GSL_LOC
123-
gsl
124-
ENV LD_LIBRARY_PATH)
125-
126-
find_library(GSLCBLAS_LOC
127-
gslcblas
128-
ENV LD_LIBRARY_PATH)
129-
130-
MARK_AS_ADVANCED(
131-
GSL_LOC
132-
GSLCBLAS_LOC)
133-
134122
# Additional include and link directories
135123
include_directories(base9)
136124
include_directories(yaml-cpp/include)

multiPopMcmc/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ include_directories( ${YAML_CPP_INCLUDE_DIRS} "/usr/local/include" )
66

77
add_executable(multiPopMcmc ${MULTIPOPMCMC_FILES})
88

9-
target_link_libraries(multiPopMcmc base9 m ${GSL_LOC} ${GSLCBLAS_LOC} yaml-cpp)
9+
target_link_libraries(multiPopMcmc base9 m GSL::gsl GSL::gslcblas yaml-cpp)
1010

1111
install(TARGETS multiPopMcmc
1212
DESTINATION bin)

sampleMass/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ include_directories( ${YAML_CPP_INCLUDE_DIRS} "/usr/local/include" )
66

77
add_executable(sampleMass ${SAMPLEWDMASS_FILES})
88

9-
target_link_libraries(sampleMass base9 m yaml-cpp ${GSL_LOC} ${GSLCBLAS_LOC})
9+
target_link_libraries(sampleMass base9 m yaml-cpp GSL::gsl GSL::gslcblas)
1010

1111
install(TARGETS sampleMass
1212
DESTINATION bin)

singlePopMcmc/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ include_directories( ${YAML_CPP_INCLUDE_DIRS} "/usr/local/include" )
66

77
add_executable(singlePopMcmc ${MPIMCMC_FILES})
88

9-
target_link_libraries(singlePopMcmc base9 m ${GSL_LOC} ${GSLCBLAS_LOC} yaml-cpp)
9+
target_link_libraries(singlePopMcmc base9 m GSL::gsl GSL::gslcblas yaml-cpp)
1010

1111
install(TARGETS singlePopMcmc
1212
DESTINATION bin)

0 commit comments

Comments
 (0)