I’m trying to compile my project using CMake. okFrontPanelDLL.h and okFrontPanel.dll are in the root folder of the project as is CMakeLists.txt. Has anyone used CMake with FrontPanel? What am I doing wrong in CMake?
When I compile I see the following errors:
CMakeFiles\TestAcquireStore.dir/objects.a(NeuralInterfaces.cpp.obj): In function `OpalKellyLegacy::okCFrontPanel::okCFrontPanel()':
C:/Users/nated/Google Drive/College/bci/AcquireStore/okFrontPanelDLL.h:1208: undefined reference to `__imp_okFrontPanel_Construct'
CMakeFiles\TestAcquireStore.dir/objects.a(NeuralInterfaces.cpp.obj): In function `OpalKellyLegacy::okCFrontPanel::~okCFrontPanel()':
C:/Users/nated/Google Drive/College/bci/AcquireStore/okFrontPanelDLL.h:1210: undefined reference to `__imp_okFrontPanel_Destruct'
Here’s my CMakeLists.txt
cmake_minimum_required(VERSION 3.6)
project(AcquireStore CXX)
#use C++14
set(CMAKE_CXX_STANDARD 14)
#output build results in the root directory
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR})
#pick some files
set(SOURCE_FILES
NeuralInterfaces.h
NeuralInterfaces.cpp
NeuralInterface.hpp
Tests.cpp
)
#use FrontPanel
find_path(FrontPanel_INCLUDE_DIR okFrontPanelDLL.h)
find_library(okFrontPanel_LIBRARY okFrontPanel)
#add frontpanel to source libraries
if(FrontPanel_INCLUDE_DIR AND okFrontPanel_LIBRARY)
set(okFrontPanel_FOUND TRUE)
include_directories(${Front_Panel_INCLUDE_DIR})
set(SOURCE_LIBRARIES
${okFrontPanel_LIBRARY}
)
endif()
#compile and link the library
if(okFrontPanelFOUND EQUAL TRUE)
#create the dll
add_library(AcquireStore SHARED ${SOURCE_FILES})
set_target_properties(AcquireStore PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(AcquireStore ${SOURCE_LIBRARIES})
endif()
#we need to create an executable or CMake won't work
add_executable(TestAcquireStore ${SOURCE_FILES})