@@ -7,6 +7,7 @@ cmake_minimum_required(VERSION 3.12)
77include_directories (${CMAKE_SOURCE_DIR} /utils )
88include_directories (${CMAKE_SOURCE_DIR} /common )
99
10+
1011# ----------------------------------------------------------------------------
1112# Setup for appropriate hardware interface...
1213#
@@ -17,6 +18,8 @@ include_directories(${CMAKE_SOURCE_DIR}/common)
1718# interface target for interfacing to appropriate hardware
1819# ----------------------------------------------------------------------------
1920
21+
22+
2023# ----------------------------------------------------------------------------
2124# AstroCam ARC-64/66 PCI/e interfaces
2225# ----------------------------------------------------------------------------
@@ -55,21 +58,18 @@ if (${INTERFACE_TYPE} STREQUAL "AstroCam")
5558 find_library (CARC_DEVICE "CArcDevice3.6" NAMES "libCArcDevice3.6.so" PATHS ${ARCAPI_DIR} /Release )
5659 find_library (CARC_FITS "CArcFitsFile3.6" NAMES "libCArcFitsFile3.6.so" PATHS ${ARCAPI_DIR} /Release )
5760
61+ add_library (interface STATIC ${INTERFACE_SOURCE} )
62+
63+
5864 # ----------------------------------------------------------------------------
5965 # STA Archon interfaces
6066 # ----------------------------------------------------------------------------
6167
6268elseif (${INTERFACE_TYPE} STREQUAL "Archon" )
6369 message (STATUS "compiling for STA Archon" )
64- set (INTERFACE_TARGET archon)
6570 add_definitions (-Wall -ansi -O1 -Wno-variadic-macros -std=c++17 -ggdb )
6671 add_definitions (-DSTA_ARCHON )
67- list (APPEND INTERFACE_SOURCE
68- "archon.cpp"
69- )
70- list (APPEND INTERFACE_INCLUDES
71- "${ARCHON_INCLUDE} "
72- )
72+ list (APPEND INTERFACE_SOURCE "archon.cpp" )
7373 add_library (interface STATIC "${INTERFACE_SOURCE} " )
7474 if (${DETECTOR_TYPE} STREQUAL "Hxrg" )
7575 message (STATUS "compiling for HXRG detector" )
@@ -112,38 +112,15 @@ endif ()
112112
113113# Now add the defined interface target:
114114#
115- add_library (${INTERFACE_TARGET} ${INTERFACE_SOURCE} )
116- target_include_directories (${INTERFACE_TARGET} PUBLIC ${INTERFACE_INCLUDES} )
115+ target_link_libraries (interface PUBLIC cfitsio CCfits )
117116
118117
119- add_library (camera camera.cpp )
120-
121- # ----------------------------------------------------------------------------
122- # External libraries, such as FITS, etc.
123- # ----------------------------------------------------------------------------
124-
125- #cfitsio has provided a cmake config file for quite a long time
126- #on some systems where include files are not in the default place, this will still find them
127- #if it fails, we fall back to camerad previous behaviour, manually finding the library file ONLY
128- #(and not bothering about includes if they're not in the right place)
129- find_package (cfitsio )
130-
131- #the package file defines a cmake target rather than just the variables
132- #that target will also have correct path to include files
133- if (NOT TARGET cfitsio)
134- message (STATUS "cfitsio package file not found, maybe an old old system. Try finding library manually" )
135- find_library (CFITS_LIB cfitsio NAMES libcfitsio PATHS /usr/local/lib )
136- add_library (cfitsio UNKNOWN IMPORTED )
137- set_target_properties (cfitsio PROPERTIES IMPORTED_LOCATION ${CFITS_LIB} )
138- endif ()
139-
140- #for CCfits, we now provide our own find module
141- #this allows for systems with non-standard paths to
142- #replace that find module without hacking our build system (e.g. fedora, suse, etc)
143118
119+ #Note from danw: I'm afraid camera.h technically includes CCfits, and so a public
120+ #dependency on those is needed
121+ add_library (camera camera.cpp )
122+ target_link_libraries (camera PUBLIC cfitsio CCfits )
144123
145- list (APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR} /cmake" )
146- find_package (CCfits REQUIRED )
147124
148125find_package (Threads )
149126add_executable (camerad camerad.cpp ${INTERFACE_INCLUDES} )
@@ -158,15 +135,14 @@ target_link_libraries(camerad
158135 logentry
159136 common
160137 utilities
161- ${INTERFACE_TARGET}
138+ interface
162139 ${CMAKE_THREAD_LIBS_INIT}
163140 cfitsio
164141 CCfits
165142)
166143
167- target_link_libraries (camerad ${CARC_BASE} )
168- target_link_libraries (camerad ${CARC_DEVICE} )
169- target_link_libraries (camerad ${CARC_FITS} )
144+ target_link_libraries (camerad ${CARC_BASE} ${CARC_DEVICE} ${CARC_FITS} )
145+
170146
171147# ----------------------------------------------------------------------------
172148# cURL is not used here, so it's not strictly required, but cfitsio can
0 commit comments