-
Notifications
You must be signed in to change notification settings - Fork 354
Description
Problem
Installing using GNU autotools steps created following issues
find_packagein custom cmake project does not work (sinceFreeOpcUaConfig.cmakehas not been generated)- subset of include files don't get copied to target include dir (e.g.
opc/common/logger.h, entireopc/spdlogdir)
Additional info
OS: GNU/Linux (Ubuntu 20.04)
install target: /usr/local
repo branch: master
autoconf version: 2.69
custom cmake project file
cmake_minimum_required(VERSION 3.10.2)
project(my_opcua_proj)
add_compile_options(-std=c++11 -Wall)
find_package(FreeOpcUa REQUIRED)
add_library(my_server
src/my_server.cpp
)
target_link_libraries(my_server
${ADDITIONAL_LINK_LIBRARIES}
opcuaprotocol
opcuacore
opcuaserver
)where my_server.cpp is exact copy of freeopcua/src/examples/example_server.cpp
Tried Solution
For 1, a temporary "fix" was applied by creating /usr/local/lib/cmake/FreeOpcUaConfig.cmake with following content
# Set the paths for FreeOpcUA
set(FreeOpcUA_INCLUDE_DIRS "/usr/local/include")
set(FreeOpcUA_LIBRARY_DIRS "/usr/local/lib")
# Add the include and library directories to the appropriate variables
list(APPEND CMAKE_INCLUDE_PATH ${FreeOpcUA_INCLUDE_DIRS})
list(APPEND CMAKE_LIBRARY_PATH ${FreeOpcUA_LIBRARY_DIRS})
# Provide information about the FreeOpcUA libraries
set(FreeOpcUA_LIBRARIES "opcuaprotocol opcuacore opcuaserver")which helped progress to issue 2. where the cmake call succeeds but make call fails with error about unable to find opc/common/logger.h in custom cmake project. This was "fixed" by manually copying logger.h from cloned freeopcua/include/opc/common/ to the respective directory in /usr/local/include. After that, same issue occurs during make call with spdlog files.
Upon uninstalling and removing all the files from target install and installing using cmake instructions worked like a charm.
Possible Conclusion
Maybe 🤷🏽♂️ autotools instructions are outdated compared to cmake.
PS: For my use case installation with cmake was sufficient. Just created issue for future users since I could not find anything similar in the open issues.