add_library(cpf_devices STATIC)
target_include_directories(cpf_devices PUBLIC . GPSUBlox LTC2946_EnergyMonitor)
target_sources(cpf_devices PRIVATE
	ctdSBE41.cpp
	ctdSBE41.hpp
	GPSUBlox/GPSUBlox.cpp
	GPSUBlox/GPSUBlox.hpp
	GPSUBlox/__GPSUBlox_helpers.cpp
	GPSUBlox/__GPSUBlox_helpers.hpp
	LTC2946_EnergyMonitor/LTC2946_EnergyMonitor.hpp
	LTC2946_EnergyMonitor/LTC2946_EnergyMonitor.cpp
	LTC2946_EnergyMonitor/__LTC2946_definitions.hpp
	LTC2946_EnergyMonitor/__LTC2946_LinearDriver.hpp
	LTC2946_EnergyMonitor/__LTC2946_LinearDriver.cpp
	TimerManager.hpp
	ElmoTwitter.cpp
	ElmoTwitter.hpp
	BellowsValve.cpp
	BellowsValve.hpp
	DevicePowerSwitch.cpp
	DevicePowerSwitch.hpp
	BellowsPositionADC2485.cpp
	BellowsPositionADC2485.hpp
)

# This allows building/linking cpf_devices for unit tests that are run
# on the build host.
if (CMAKE_CROSSCOMPILING)
	target_link_libraries(cpf_devices PRIVATE stm32h7_target_include_dep)
endif()
target_link_libraries(cpf_devices PUBLIC
	etl::etl
	logger_include_dep
	cpf_interfaces_include_dep
)

add_library(cpf_devices_include_dep INTERFACE)
target_include_directories(cpf_devices_include_dep INTERFACE . GPSUBlox LTC2946_EnergyMonitor)
target_link_libraries(cpf_devices_include_dep INTERFACE etl::etl)

add_library(cpf_devices_tests INTERFACE)
target_include_directories(cpf_devices_tests INTERFACE .)
target_sources(cpf_devices_tests INTERFACE
	TimerManager_tests.cpp
)

add_library(cpf_hw_driver_build_host_tests INTERFACE)
target_include_directories(cpf_hw_driver_build_host_tests INTERFACE .)
target_sources(cpf_hw_driver_build_host_tests INTERFACE
	ElmoTwitter_tests.cpp
	GPSUBlox/GPSUBlox_tests.cpp
	BellowsPositionADC2485_tests.cpp
)
target_link_libraries(cpf_hw_driver_build_host_tests INTERFACE cpf_devices)
