Greg replied to the topic 'Trouble Linking Libraries' in the forum. 5 years ago

I added the lines to my CMakeLists but I am still getting build errors. Here is my updated CMake file

cmake_minimum_required(VERSION 3.4 FATAL_ERROR)
project(pandaScope)

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_CFLAGS} -O3 -Wall")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMakeModules)

find_package(OpenCV REQUIRED)
find_package(GSL REQUIRED)
find_package(Eigen3 3.3 REQUIRED NO_MODULE)
find_package(Boost REQUIRED)
find_package(INDI 1.7 REQUIRED)
find_package(Nova REQUIRED)
find_package(CFITSIO REQUIRED)

add_library(cspice STATIC IMPORTED)

set_property(TARGET
cspice
PROPERTY
IMPORTED_LOCATION
/usr/lib/cspice.a)

INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIR} )
include_directories(${INDI_INCLUDE_DIR})
include_directories(${NOVA_INCLUDE_DIR})
include_directories(${CFITSIO_INCLUDE_DIR})

IF (CMAKE_BUILD_TYPE MATCHES COVERAGE)
include(CodeCoverage)
APPEND_COVERAGE_COMPILER_FLAGS()
ENDIF (CMAKE_BUILD_TYPE MATCHES COVERAGE)

set(SOURCE ${SOURCE}
src/main.cpp
src/focus/focuser.cpp
src/detection/detection.cpp
src/iod/state_generation.cpp
src/iod/lambert_gooding.cpp
src/batch/lambert.cpp
src/batch/batch.cpp
src/utilities/conversions.cpp
src/utilities/kernels.cpp
src/batch/propagator.cpp
src/telescope/functions.cpp
src/telescope/operation.cpp)

set(HEADERS ${HEADERS}
src/includes.hpp
src/focus/focuser.hpp
src/detection/detection.hpp
src/iod/state_generation.hpp
src/iod/lambert_gooding.hpp
dependencies/cxxopts.hpp
src/batch/lambert.hpp
src/batch/batch.hpp
src/utilities/conversions.hpp
src/utilities/vectors.hpp
src/utilities/kernels.hpp
src/batch/propagator.hpp
src/telescope/functions.hpp
src/telescope/operation.hpp)

add_subdirectory(testing)

add_executable(pandaScope ${SOURCE} ${HEADERS})

target_link_libraries(pandaScope ${OpenCV_LIBS})
target_link_libraries(pandaScope usbp-1)
target_link_libraries(pandaScope GSL::gsl GSL::gslcblas)
target_link_libraries(pandaScope Eigen3::Eigen)
target_link_libraries(pandaScope LINK_PUBLIC ${Boost_LIBRARIES})
target_link_libraries(pandaScope cspice)
target_link_libraries(pandaScope ${INDI_CLIENT_LIBRARIES})
target_link_libraries(pandaScope ${INDI_LIBRARIES})
target_link_libraries(pandaScope ${NOVA_LIBRARIES})
target_link_libraries(pandaScope ${CFITSIO_LIBRARIES})

Read More...