diff --git a/cmake/set_control_system_adapter.cmake b/cmake/set_control_system_adapter.cmake index e95c1a135ba9866217034604a542e2c9b6c5b9a4..6d52e98066d57beec304cc0ecfd7a6697f5100a0 100644 --- a/cmake/set_control_system_adapter.cmake +++ b/cmake/set_control_system_adapter.cmake @@ -26,30 +26,26 @@ ####################################################################################################################### # Select control system adapter -IF(ADAPTER STREQUAL "OPCUA") +if(ADAPTER STREQUAL "OPCUA") message("Building against the OPC UA ControlSystemAdater") - add_dependency(ChimeraTK-ControlSystemAdapter-OPCUAAdapter 03.00 REQUIRED) - set(Adapter_LINK_FLAGS ${ChimeraTK-ControlSystemAdapter-OPCUAAdapter_LINK_FLAGS}) - set(Adapter_LIBRARIES ${ChimeraTK-ControlSystemAdapter-OPCUAAdapter_LIBRARIES}) -ELSEIF(ADAPTER STREQUAL "DOOCS") + find_package(ChimeraTK-ControlSystemAdapter-OPCUAAdapter 03.00 REQUIRED) + add_library(ChimeraTK::SelectedAdapter ALIAS ChimeraTK::ChimeraTK-ControlSystemAdapter-OPCUAAdapter) +elseif(ADAPTER STREQUAL "DOOCS") message("Building against the DOOCS ControlSystemAdater") - add_dependency(ChimeraTK-ControlSystemAdapter-DoocsAdapter 01.08 REQUIRED) - set(Adapter_LINK_FLAGS ${ChimeraTK-ControlSystemAdapter-DoocsAdapter_LINK_FLAGS}) - set(Adapter_LIBRARIES ${ChimeraTK-ControlSystemAdapter-DoocsAdapter_LIBRARIES}) -ELSEIF(ADAPTER STREQUAL "EPICSIOC") + find_package(ChimeraTK-ControlSystemAdapter-DoocsAdapter 01.08 REQUIRED) + add_library(ChimeraTK::SelectedAdapter ALIAS ChimeraTK::ChimeraTK-ControlSystemAdapter-DoocsAdapter) +elseif(ADAPTER STREQUAL "EPICSIOC") message("Building against the EPICS IOC ControlSystemAdater") - add_dependency(ChimeraTK-ControlSystemAdapter-EPICS-IOC-Adapter 02.00 REQUIRED) - set(Adapter_LINK_FLAGS ${ChimeraTK-ControlSystemAdapter-EPICS-IOC-Adapter_LINK_FLAGS}) - set(Adapter_LIBRARIES ${ChimeraTK-ControlSystemAdapter-EPICS-IOC-Adapter_LIBRARIES}) -ELSEIF(ADAPTER STREQUAL "EPICS7IOC") + find_package(ChimeraTK-ControlSystemAdapter-EPICS-IOC-Adapter 02.00 REQUIRED) + add_library(ChimeraTK::SelectedAdapter ALIAS ChimeraTK::ChimeraTK-ControlSystemAdapter-EPICS-IOC-Adapter) +elseif(ADAPTER STREQUAL "EPICS7IOC") message("Building against the EPICS ver. 7.0 IOC ControlSystemAdater") - add_dependency(ChimeraTK-ControlSystemAdapter-EPICS7-IOC-Adapter 02.00 REQUIRED) - set(Adapter_LINK_FLAGS ${ChimeraTK-ControlSystemAdapter-EPICS7-IOC-Adapter_LINK_FLAGS}) - set(Adapter_LIBRARIES ${ChimeraTK-ControlSystemAdapter-EPICS7-IOC-Adapter_LIBRARIES}) -ELSE() + find_package(ChimeraTK-ControlSystemAdapter-EPICS7-IOC-Adapter 02.00 REQUIRED) + add_library(ChimeraTK::SelectedAdapter ALIAS ChimeraTK::ChimeraTK-ControlSystemAdapter-EPICS7-IOC-Adapter) +else() message(FATAL_ERROR "Please select your ControlSystemAdapter to use by passing to the cmake command line:\n" " -DADAPTER=DOOCS to build a DOOCS server\n" " -DADAPTER=OPCUA to build an OPC UA server\n" " -DADAPTER=EPICSIOC to build an EPICS ver. 3.16 IOC\n" " -DADAPTER=EPICS7IOC to build an EPICS ver. 7.0 IOC") -ENDIF() +endif()