From 5f3bab4136f51d9838414fefaf7bbfabe6d301e1 Mon Sep 17 00:00:00 2001
From: Jesse Mapel <jmapel@usgs.gov>
Date: Thu, 3 Oct 2019 16:04:49 -0700
Subject: [PATCH] Updated cmake stuff (#285)

* Updated cmake stuff

* More updates
---
 CMakeLists.txt              | 50 ++++++++++++++++---------------------
 tests/ctests/CMakeLists.txt | 14 +++++------
 2 files changed, 28 insertions(+), 36 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 57e843b..48104fc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,7 +7,7 @@
 # Specify the required version of CMake.
 # cmake 3.10 required for ctest/gtest integration
 cmake_minimum_required(VERSION 3.10)
-project(ale VERSION 0.3.0 DESCRIPTION "Abstraction Library for Ephemerides ")
+project(ale VERSION 0.5.0 DESCRIPTION "Abstraction Library for Ephemerides ")
 
 # include what we need
 include(GNUInstallDirs)
@@ -32,40 +32,32 @@ target_include_directories(ale
                            PUBLIC
                            ${ALE_INCLUDE_DIRS})
 
- target_link_libraries(ale
-                       PRIVATE
-                       GSL::gsl
-                       GSL::gslcblas
-                       Eigen3::Eigen
-                       Python::Python
-                       nlohmann_json::nlohmann_json)
+target_link_libraries(ale
+                      PRIVATE
+                      GSL::gsl
+                      GSL::gslcblas
+                      Eigen3::Eigen
+                      Python::Python
+                      nlohmann_json::nlohmann_json)
 
 # Optional build tests
 option (BUILD_TESTS "Build tests" ON)
 if(BUILD_TESTS)
-  include(cmake/gtest.cmake)
-  include(GoogleTest)
-  include(CTest)
+    include(cmake/gtest.cmake)
+    include(GoogleTest)
+    include(CTest)
 
-  find_package (Threads)
+    find_package (Threads)
+    enable_testing()
+    add_subdirectory(tests/ctests)
 
-  target_link_libraries(ale
-                        PRIVATE
-                        GSL::gsl
-                        GSL::gslcblas
-                        Python::Python
-                        PUBLIC
-                        gtest ${CMAKE_THREAD_LIBS_INIT})
-  enable_testing()
-  add_subdirectory(tests/ctests)
-
-  # Setup for code coverage
-  # default to off
-  set(COVERAGE OFF CACHE BOOL "Coverage")
-  if(COVERAGE)
-      target_compile_options(ale PRIVATE --coverage -O0)
-      target_link_libraries(ale PRIVATE --coverage -O0)
-  endif()
+    # Setup for code coverage
+    # default to off
+    set(COVERAGE OFF CACHE BOOL "Coverage")
+    if(COVERAGE)
+        target_compile_options(ale PRIVATE --coverage -O0)
+        target_link_libraries(ale PRIVATE --coverage -O0)
+    endif()
 endif()
 
 # Install commands
diff --git a/tests/ctests/CMakeLists.txt b/tests/ctests/CMakeLists.txt
index fda311e..009827a 100644
--- a/tests/ctests/CMakeLists.txt
+++ b/tests/ctests/CMakeLists.txt
@@ -6,12 +6,12 @@ file(GLOB test_source "${CMAKE_SOURCE_DIR}/tests/ctests/*.cpp")
 # setup test executable
 add_executable(runAleTests ${test_source})
 target_link_libraries(runAleTests
-                       ale
-                       GSL::gsl
-                       GSL::gslcblas
-                       Eigen3::Eigen
-                       ${GTEST_LIBRARIES}
-                       ${GTEST_MAIN_LIBRARIES}
-                       pthread)
+                      PRIVATE
+                      ale
+                      GSL::gsl
+                      GSL::gslcblas
+                      Eigen3::Eigen
+                      gtest
+                      Threads::Threads)
 
 gtest_discover_tests(runAleTests WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests/ctests)
-- 
GitLab