I am trying to install a package called DICe available here: https://github.com/dicengine/dice on my Ubuntu 20.04 LTS using source code. This package requires another package called Trilinos : https://trilinos.github.io/ . I have successfully build the Trilinos in the following path: ~/Documents/Trilinos/. Now the problem is, when I try to build the DCIe in ~/Documents/DCIe/ it shows error:
CMake Error at CMakeLists.txt:22 (find_package):
By not providing "FindTrilinos.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Trilinos",
but CMake did not find one.
Could not find a package configuration file provided by "Trilinos" with any
of the following names:
TrilinosConfig.cmake
trilinos-config.cmake
Add the installation prefix of "Trilinos" to CMAKE_PREFIX_PATH or set
"Trilinos_DIR" to a directory containing one of the above files. If
"Trilinos" provides a separate development package or SDK, be sure it has
been installed.
I have extracted DCIe source code in ~/Downloads/dice2.0. Can someone guide me how I am supposed to configure the CmakeLists.txt? Here is my changed version:
MESSAGE("\nConfiguring DICe...\n")
# check if the pre-compiled set of libraries and header for windows is being used:
IF(DEFINED DICE_DEVPACK_DIR)
MESSAGE(STATUS "***Using DevPack from: ${DICE_DEVPACK_DIR}")
MESSAGE(STATUS "Note: if any of the following variables have been defined, they will be reset\n DICE_TRILINOS_DIR\n OpenCV_DIR\n CLAPACK_DIR\n NetCDF_DIR\n HDF5_DIR")
SET(DICE_TRILINOS_DIR "${DICE_DEVPACK_DIR}/trilinos")
SET(OpenCV_DIR "${DICE_DEVPACK_DIR}/opencv")
SET(NetCDF_DIR "${DICE_DEVPACK_DIR}/netcdf/lib")
SET(HDF5_DIR "${DICE_DEVPACK_DIR}/netcdf/lib")
SET(CLAPACK_DIR "${DICE_DEVPACK_DIR}/lapack")
link_directories(${CLAPACK_DIR}/F2CLIBS)
ENDIF()
# Try to find Trilinos, if path was not given
IF (NOT DEFINED DICE_TRILINOS_DIR)
# Losely based on:
# https://github.com/trilinos/Trilinos_tutorial/wiki/CMakeFindPackageTrilinosExample
# /usr/share/doc/opencv-doc/examples/face/CMakeLists.txt
# * Find Trilinos
find_package(Trilinos REQUIRED)
IF(Trilinos_FOUND)
MESSAGE("\nFound Trilinos")
SET(DICE_TRILINOS_DIR ${Trilinos_DIR})
MESSAGE("Trilinos_DIR = ${DICE_TRILINOS_DIR}")
ELSE()
MESSAGE(FATAL_ERROR "Could not find Trilinos")
ENDIF()
ENDIF()
MESSAGE(STATUS "Using Trilinos installed in: ${DICE_TRILINOS_DIR}")
# If this is a windows build CLAPACK is required. Find package for
# clapack is automatically enabled by setting the CLAPACK_DIR variable
IF(WIN32 AND NOT DEFINED DICE_DEVPACK_DIR)
# must defined clapack_dir
IF (NOT DEFINED CLAPACK_DIR)
MESSAGE(FATAL_ERROR "\nDICe Error: this is a windows build, so cmake must define CLAPACK_DIR:
(-D CLAPACK_DIR:FILEPATH=<clapack_install_prefix>)!")
ENDIF()
FIND_PACKAGE(clapack PATHS ${CLAPACK_DIR})
IF(clapack_FOUND)
MESSAGE("\nFound CLAPACK in ${CLAPACK_DIR}")
link_directories(${CLAPACK_DIR}/F2CLIBS/libf2c)
ELSE()
MESSAGE("\nERROR: could not find CLAPACK in the following directory: ${CLAPACK_DIR}")
ENDIF()
ENDIF()
IF(WIN32)
IF(NOT BUILD_SHARED_LIBS)
MESSAGE("\nWarning: This is a windows build, but BUILD_SHARED_LIBS is OFF. Setting BUILD_SHARED_LIBS on automatically.")
SET(BUILD_SHARED_LIBS ON)
ENDIF(NOT BUILD_SHARED_LIBS)
ENDIF(WIN32)
IF(BUILD_SHARED_LIBS)
MESSAGE(STATUS "BUILD_SHARED_LIBS is set to ON")
ELSE(BUILD_SHARED_LIBS)
MESSAGE(STATUS "BUILD_SHARED_LIBS is set to OFF")
ENDIF(BUILD_SHARED_LIBS)
# Get Trilinos as one entity
# SET(Trilinos_DIR CACHE PATH "~/Documents/Trilinos")
SET(CMAKE_PREFIX_PATH ${DICE_TRILINOS_DIR} ${CMAKE_PREFIX_PATH})
FIND_PACKAGE(Trilinos PATHS ~/Documents/Trilinos)
IF(NOT Trilinos_FOUND)
MESSAGE(FATAL_ERROR "Could not find Trilinos!")
ENDIF()
MESSAGE("\nFound Trilinos! Here are the details: ")
MESSAGE(" Trilinos_DIR = ${Trilinos_DIR}")
MESSAGE(" Trilinos_VERSION = ${Trilinos_VERSION}")
MESSAGE(" Trilinos_PACKAGE_LIST = ${Trilinos_PACKAGE_LIST}")
MESSAGE(" Trilinos_LIBRARIES = ${Trilinos_LIBRARIES}")
MESSAGE(" Trilinos_INCLUDE_DIRS = ${Trilinos_INCLUDE_DIRS}")
MESSAGE(" Trilinos_LIBRARY_DIRS = ${Trilinos_LIBRARY_DIRS}")
MESSAGE(" Trilinos_TPL_LIST = ${Trilinos_TPL_LIST}")
MESSAGE(" Trilinos_TPL_INCLUDE_DIRS = ${Trilinos_TPL_INCLUDE_DIRS}")
MESSAGE(" Trilinos_TPL_LIBRARIES = ${Trilinos_TPL_LIBRARIES}")
MESSAGE(" Trilinos_TPL_LIBRARY_DIRS = ${Trilinos_TPL_LIBRARY_DIRS}")
MESSAGE(" Trilinos_BUILD_SHARED_LIBS = ${Trilinos_BUILD_SHARED_LIBS}")
MESSAGE("End of Trilinos details\n")
IF(NOT DEFINED DICE_DEVPACK_DIR)
SET(CMAKE_CXX_COMPILER ${Trilinos_CXX_COMPILER} )
SET(CMAKE_C_COMPILER ${Trilinos_C_COMPILER} )
ENDIF()
SET(CMAKE_VERBOSE_MAKEFILE OFF)
IF(NOT DEFINED DICE_MPI_EXEC)
SET(DICE_MPI_EXEC mpiexec)
ENDIF()
# End of setup and error checking
# NOTE: PROJECT command checks for compilers, so this statement
# is moved AFTER setting CMAKE_CXX_COMPILER opton
PROJECT(DICe)
MESSAGE(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
SET(DICE_OUTPUT_PREFIX ${CMAKE_CURRENT_BINARY_DIR})
MESSAGE(STATUS "The output directory for DICe libraries will be: ${DICE_OUTPUT_PREFIX}/lib")
MESSAGE(STATUS "If 'make install' is exectued, the libraries will also be copied to: ${CMAKE_INSTALL_PREFIX}/lib")
# See if tracklib is available
IF(DEFINED TRACKLIB_DIR)
MESSAGE(STATUS "TRACKLIB is ON")
MESSAGE(STATUS "TRACKLIB_DIR is set to: ${TRACKLIB_DIR}")
ADD_DEFINITIONS(-DDICE_ENABLE_TRACKLIB=1)
ELSE()
MESSAGE(STATUS "TRACKLIB is OFF")
ENDIF()
# Try to find OpenCV, if path was not given
IF (NOT DEFINED OpenCV_DIR)
# Losely based on:
# https://github.com/trilinos/Trilinos_tutorial/wiki/CMakeFindPackageTrilinosExample
# /usr/share/doc/opencv-doc/examples/face/CMakeLists.txt
# * Find OpenCV
message(STATUS "OpenCV_DIR not specified, looking in default paths")
find_package(OpenCV REQUIRED)
ELSE()
message(STATUS "Looking for OpenCV in dir: ${OpenCV_DIR}")
find_package( OpenCV NO_DEFAULT_PATH PATHS ${OpenCV_DIR} )
ENDIF()
IF(OpenCV_FOUND)
set(DICE_ENABLE_OPENCV ON)
IF(WIN32)
FILE(GLOB OPENCV_DLLS ${OpenCV_DIR}/x64/vc12/bin/*.dll)
FILE(COPY ${OPENCV_DLLS} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin)
FILE(GLOB OPENCV_DLLS ${OpenCV_DIR}/x64/vc15/bin/*.dll)
FILE(COPY ${OPENCV_DLLS} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin)
ENDIF()
ELSE()
message(FATAL_ERROR "OpenCV not found. OpenCV is now a required package in DICe")
ENDIF()
# FIND NETCDF
set(DICE_ENABLE_NETCDF OFF)
if(DEFINED NetCDF_DIR)
set(DICE_ENABLE_NETCDF ON)
MESSAGE(STATUS "Looking for NetCDF in: ${NetCDF_DIR}")
find_library(NetCDF_lib NAMES libnetcdf.a netcdf PATHS ${NetCDF_DIR})
MESSAGE(STATUS "Looking for HDF5 in: ${HDF5_DIR}")
find_library(HDF5_lib NAMES libhdf5.a hdf5 PATHS ${HDF5_DIR} NO_DEFAULT_PATH)
find_library(HDF5_lib NAMES libhdf5.a hdf5 PATHS ${HDF5_DIR})
find_library(HDF5_hl_lib NAMES libhdf5_hl.a hdf5_hl PATHS ${HDF5_DIR} NO_DEFAULT_PATH)
find_library(HDF5_hl_lib NAMES libhdf5_hl.a hdf5_hl PATHS ${HDF5_DIR})
MESSAGE(STATUS "Using NetCDF lib: ${NetCDF_lib}")
MESSAGE(STATUS "Using HDF5 libs: ${HDF5_lib} ${HDF5_hl_lib}")
IF(NOT NetCDF_lib_NOTFOUND)
SET(DICE_LIBRARIES ${DICE_LIBRARIES} ${NetCDF_lib})
SET(DICE_LIBRARIES ${DICE_LIBRARIES} ${HDF5_lib})
SET(DICE_LIBRARIES ${DICE_LIBRARIES} ${HDF5_hl_lib})
ADD_DEFINITIONS(-DDICE_ENABLE_NETCDF=1)
include_directories(${NetCDF_DIR}/../include)
link_directories(${NetCDF_DIR}/../lib)
IF(WIN32)
FILE(GLOB NetCDF_DLLS ${NetCDF_DIR}/../bin/*.dll)
FILE(COPY ${NetCDF_DLLS} DESTINATION ${DICE_OUTPUT_PREFIX}/bin)
ENDIF()
ELSE()
message(FATAL_ERROR "Error, NetCDF enabled but not found")
ENDIF()
else()
MESSAGE(STATUS "NetCDF will NOT be enabled")
endif()
#
# Hypercine library for reading cine files
#
include(ExternalProject)
MESSAGE(STATUS "Configuring hypercine")
SET(HYPERCINE_CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DHYPERCINE_DEBUG_MSG:BOOL=${DICE_DEBUG_MSG} -DOpenCV_DIR:PATH=${OpenCV_DIR})
# base data type:
if(DICE_USE_INT_STORAGE)
SET(HYPERCINE_CMAKE_ARGS ${HYPERCINE_CMAKE_ARGS} -DHYPERCINE_USE_INT_STORAGE:BOOL=ON)
ADD_DEFINITIONS(-DUSE_INT_STORAGE=1)
elseif(DICE_USE_DOUBLE)
SET(HYPERCINE_CMAKE_ARGS ${HYPERCINE_CMAKE_ARGS} -DHYPERCINE_USE_DOUBLE_STORAGE:BOOL=ON)
ADD_DEFINITIONS(-DUSE_DOUBLE_STORAGE=1)
else()
SET(HYPERCINE_CMAKE_ARGS ${HYPERCINE_CMAKE_ARGS} -DHYPERCINE_USE_FLOAT_STORAGE:BOOL=ON)
ADD_DEFINITIONS(-DUSE_FLOAT_STORAGE=1)
endif()
ExternalProject_Add(hypercine
GIT_REPOSITORY git://github.com/dicengine/hypercine.git
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/hypercine
CMAKE_ARGS ${HYPERCINE_CMAKE_ARGS}
)
# base data type:
if(DICE_USE_DOUBLE)
ADD_DEFINITIONS(-DDICE_USE_DOUBLE=1)
MESSAGE(STATUS "Scalar type will be: DOUBLE")
else()
MESSAGE(STATUS "Scalar type will be: FLOAT (default)")
endif()
if(DICE_USE_INT_STORAGE)
ADD_DEFINITIONS(-DDICE_USE_INT_STORAGE=1)
MESSAGE(STATUS "Image intensity storage type will be: INT")
else()
IF(DICE_USE_DOUBLE)
MESSAGE(STATUS "Image intensity storage type will be: DOUBLE")
ELSE()
MESSAGE(STATUS "Image intensity storage type will be: FLOAT (default)")
ENDIF()
endif()
# MPI check -- defaults to TRUE
LIST(FIND Trilinos_TPL_LIST MPI MPI_List_ID)
IF (MPI_List_ID GREATER -1)
MESSAGE(STATUS "Checking if MPI is enabled in Trilinos: MPI ENABLED")
SET(DICE_MPI TRUE)
ADD_DEFINITIONS(-DDICE_MPI=1)
MESSAGE(STATUS "Using DICE_MPI_EXEC: ${DICE_MPI_EXEC}")
ELSE()
MESSAGE(STATUS "Checking if MPI is enabled in Trilinos: MPI NOT ENABLED")
SET(DICE_MPI FALSE)
ENDIF()
SET(DICE_TRILINOS_HEADERS
${Trilinos_INCLUDE_DIRS}
${Trilinos_TPL_INCLUDE_DIRS}
)
SET(DICE_TRILINOS_LIB_DIRS
${Trilinos_LIBRARY_DIRS}
${Trilinos_TPL_LIBRARY_DIRS}
)
link_directories(${DICE_TRILINOS_LIB_DIRS})
ExternalProject_Get_Property(hypercine source_dir)
include_directories(${source_dir}/src)
set(libprefix "lib")
set(libsuffix ".a")
if(WIN32)
set(libprefix "")
set(libsuffix ".lib")
endif()
set(DICE_LIBRARIES ${DICE_LIBRARIES} "${libprefix}hypercine${libsuffix}")
set(DICE_UTILS_LIBRARIES ${DICE_UTILS_LIBRARIES} "${libprefix}hypercine${libsuffix}")
link_directories(${CMAKE_INSTALL_PREFIX}/lib)
if(WIN32)
link_directories(${CMAKE_INSTALL_PREFIX}/bin)
endif()
SET(DICE_HEADER_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/src/api
${CMAKE_CURRENT_SOURCE_DIR}/src/base
${CMAKE_CURRENT_SOURCE_DIR}/src/core
${CMAKE_CURRENT_SOURCE_DIR}/src/netcdf
${CMAKE_CURRENT_SOURCE_DIR}/src/fft
${CMAKE_CURRENT_SOURCE_DIR}/src/ioutils
${CMAKE_CURRENT_SOURCE_DIR}/src/rawi
${CMAKE_CURRENT_SOURCE_DIR}/src/kdtree
${CMAKE_CURRENT_SOURCE_DIR}/src/mesh
)
IF(DEFINED TRACKLIB_DIR)
SET(DICE_HEADER_DIRS
${DICE_HEADER_DIRS}
${TRACKLIB_DIR}/src/
)
ENDIF()
MESSAGE(STATUS "DICE_ENABLE_GLOBAL: ${DICE_ENABLE_GLOBAL}")
IF(DICE_ENABLE_GLOBAL)
IF(NOT DICE_USE_DOUBLE)
MESSAGE(FATAL_ERROR "DICE_ENABLE_GLOBAL can only be used with DICE_USE_DOUBLE=ON")
ENDIF(NOT DICE_USE_DOUBLE)
SET(DICE_HEADER_DIRS
${DICE_HEADER_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/src/global
${CMAKE_CURRENT_SOURCE_DIR}/src/mesh/io
${CMAKE_CURRENT_SOURCE_DIR}/src/global/triangle)
add_definitions(-DTRILIBRARY -DANSI_DECLARATORS -DDICE_ENABLE_GLOBAL=1)
ENDIF()
IF(DICE_ENABLE_OPENCV)
SET(DICE_HEADER_DIRS
${DICE_HEADER_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/src/opencv
)
add_definitions(-DDICE_ENABLE_OPENCV=1)
ENDIF()
SET(DICE_LIBRARIES
${DICE_LIBRARIES}
teuchoscore
teuchosnumerics
teuchoscomm
teuchosparameterlist
)
IF(DICE_ENABLE_GLOBAL)
MESSAGE(STATUS "*** Enabling Global DIC (requires the Tpetra (or Epetra), Seacas libraries, and Belos in Trilinos) ***")
IF(DICE_USE_TPETRA)
SET(DICE_LIBRARIES
${DICE_LIBRARIES}
tpetra
exodus
belos
belostpetra
)
ADD_DEFINITIONS(-DDICE_TPETRA=1)
ELSE()
SET(DICE_LIBRARIES
${DICE_LIBRARIES}
epetra
exodus
belos
ifpack
belosepetra
)
ENDIF()
ELSE()
MESSAGE(STATUS "Global DIC will not be enabled (to enable, set -D DICE_ENABLE_GLOBAL:BOOL=ON in the CMake script)")
SET(DICE_LIBRARIES
${DICE_LIBRARIES}
epetra
)
ENDIF()
# WINDOWS CMake has a bug for find_package() for clapack
# f2clibs have to be added manually here
IF(WIN32)
SET(DICE_LIBRARIES ${DICE_LIBRARIES} libf2c)
ENDIF()
# if debug messages are turned on:
IF(DICE_DEBUG_MSG)
MESSAGE(STATUS "Debugging messages are ON")
ADD_DEFINITIONS(-DDICE_DEBUG_MSG=1)
ELSE(DICE_DEBUG_MSG)
MESSAGE(STATUS "Debugging messages are OFF")
ENDIF(DICE_DEBUG_MSG)
# Windows: use Trilinos compiler flags
# Linux: don't use compiler flags from Trilinos, instead set them manually
# but pick up openmp if Trilinos was compiled with it:
if(WIN32)
SET(CMAKE_CXX_FLAGS ${Trilinos_CXX_COMPILER_FLAGS})
SET(CMAKE_C_FLAGS ${Trilinos_C_COMPILER_FLAGS})
Else()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
STRING(FIND ${Trilinos_CXX_COMPILER_FLAGS} "openmp" OpenMPFound)
IF( ${OpenMPFound} GREATER -1 )
MESSAGE(STATUS "OpenMP was enabled in Trilinos so enabling it here. (Found flag at position ${OpenMPFound})")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
ENDIF()
STRING(FIND ${Trilinos_CXX_COMPILER_FLAGS} "c++11" CXX11Found)
IF( ${CXX11Found} GREATER -1 )
MESSAGE(STATUS "c++11 was enabled in Trilinos so enabling it here. (Found flag at position ${CXX11Found})")
ELSE()
MESSAGE(WARNING "could not find c++11 flag for Trilinos (c++11 is required)")
ENDIF()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
MESSAGE(STATUS "Trilinos CMAKE_CXX_FLAGS: ${Trilinos_CXX_COMPILER_FLAGS}")
MESSAGE(STATUS "Trilinos CMAKE_C_FLAGS: ${Trilinos_C_COMPILER_FLAGS}")
MESSAGE(STATUS "DICe CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
MESSAGE(STATUS "DICe CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}")
# Get the git information to put in the header message (to identify the commit corresponding
# to the executable that was run
execute_process(
COMMAND git describe --abbrev=6 --dirty --always --tags
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_SHA1
OUTPUT_STRIP_TRAILING_WHITESPACE)
MESSAGE(STATUS "Git sha1: ${GIT_SHA1}")
ADD_DEFINITIONS(-DGITSHA1=\"${GIT_SHA1}\")
add_subdirectory(src)
add_subdirectory(tools)
add_subdirectory(tests) ```
Thank you in advance.
Edit: I am using Ububtu in VirtualBox.
As #Tsyvarev rightly pointed out, I just added following lines to the CmakeLists.txt of DICe :
LIST(APPEND CMAKE_PREFIX_PATH "PATH TO TRILINOS INSTALLATION")
Hope it helps others like me. Peace.
Related
Although I tried some methods, all the libraries involved in my project were not linked, even the most basic rclcpp library.
And there is also the problem that the header file cannot be found in vscode, although I think I have given the path to the header file in CMake and the .so file, but there is still no way to solve the problem.
cmake_minimum_required(VERSION 3.5)
project(camera_aravis)
# Default to C99
if(NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 99)
endif()
# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
INCLUDE_DIRECTORIES(/usr/local/include/aravis-0.8
/home/nian/Documents/Dep/glib-2.45.2/glib
/home/nian/Documents/Dep/glib-2.45.2
/home/nian/Documents/Dep/glib-2.45.2/gmodule
/opt/ros/foxy/include
/home/nian/Documents/Dep/xmlrpcpp-master/include/xmlrpcpp
/home/nian/Documents/Dep/xmlrpcpp-master/include
)
LINK_DIRECTORIES(/usr/lib /home/nian/Documents/Dep/glib-2.45.2/glib
)
ADD_EXECUTABLE(camnode src/new.cpp)
TARGET_LINK_LIBRARIES(camnode libaravis-0.8.so libglib-2.0.so libgio-2.0.so
libgobject-2.0.so)
include_directories(
include_directories
${fcl_INCLUDE_DIRS}
)
# find other ROS2 packages
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_components REQUIRED)
find_package(std_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(camera_info_manager REQUIRED)
find_package(image_transport REQUIRED)
add_executable(test_params_rclcpp src/new.cpp)
ament_target_dependencies(test_params_rclcpp
rclcpp
rclcpp_components
sensor_msgs
std_msgs
camera_info_manager
image_transport
camera_calibration_parsers)
install(TARGETS
test_params_rclcpp
DESTINATION lib/${PROJECT_NAME}
)
add_executable(camera_param_edit src/new.cpp)
ament_target_dependencies(camera_param_edit
rclcpp
rclcpp_components
sensor_msgs
std_msgs
camera_info_manager
image_transport
camera_calibration_parsers)
install(TARGETS
camera_param_edit
DESTINATION lib/${PROJECT_NAME}
)
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
# the following line skips the linter which checks for copyrights
# uncomment the line when a copyright and license is not present in all source files
#set(ament_cmake_copyright_FOUND TRUE)
# the following line skips cpplint (only works in a git repo)
# uncomment the line when this package is not in a git repo
#set(ament_cmake_cpplint_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
endif()
ament_package()
This is my CMakeLists, but the error in the terminal is always "undefined reference to".
How can I solve this?
Below is part of my error messagea lot of errors about function references in the library
I am currently struggling to find the python headers on my system and can't include them therefore into a C++ application
this is my cmake file -->
cmake_minimum_required(VERSION 3.14)
project(ondoki-desktop VERSION 0.1 LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_TOOLCHAIN_FILE /Users/ahoehne/repos/vcpkg/scripts/buildsystems/vcpkg.cmake)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include_directories(${PYTHON_INCLUDE_DIRS})
find_package(Python3 COMPONENTS Interpreter REQUIRED)
if(DEFINED ENV{VIRTUAL_ENV} OR DEFINED ENV{CONDA_PREFIX})
set(_pip_args)
else()
set(_pip_args "--user")
endif()
include(ExternalProject)
ExternalProject_Add(ondoki-daemon
GIT_REPOSITORY "https://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#github.com/ondoki-org/ondoki-daemon.git"
GIT_TAG develop
SOURCE_DIR "${PROJECT_SOURCE_DIR}/ondoki-daemon"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
execute_process(COMMAND ${Python3_EXECUTABLE} -m pip install -r ${PROJECT_SOURCE_DIR}/ondoki-daemon/requirements.txt)
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Quick REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Quick REQUIRED)
find_package(ZeroMQ CONFIG REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED)
find_package(cppzmq CONFIG REQUIRED)
find_package(protobuf CONFIG REQUIRED)
find_package( Boost REQUIRED COMPONENTS )
find_package (Boost COMPONENTS filesystem regex REQUIRED)
find_package(msgpack CONFIG REQUIRED)
find_package(pybind11 CONFIG REQUIRED)
set(PROJECT_SOURCES
main.cpp
qml.qrc
images.qrc
python.qrc
zmqbridge.cpp
zmqbridge.h
zmqworker.h
zmqworker.cpp
)
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(ondoki-desktop
MANUAL_FINALIZATION
${PROJECT_SOURCES}
)
# Define target properties for Android with Qt 6 as:
# set_property(TARGET ondoki-desktop APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
# ${CMAKE_CURRENT_SOURCE_DIR}/android)
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
else()
if(ANDROID)
add_library(ondoki-desktop SHARED
${PROJECT_SOURCES}
)
# Define properties for Android with Qt 5 after find_package() calls as:
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
else()
add_executable(ondoki-desktop
${PROJECT_SOURCES}
)
endif()
endif()
target_compile_definitions(ondoki-desktop
PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
target_link_libraries(ondoki-desktop
PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Quick
protobuf::libprotoc protobuf::libprotobuf protobuf::libprotobuf-lite libzmq
libzmq-static nlohmann_json nlohmann_json::nlohmann_json
cppzmq cppzmq-static ${Boost_LIBRARIES} ยข{PYTHON_LIBRARIES}
msgpackc msgpackc-cxx pybind11::lto pybind11::embed pybind11::module
)
set_target_properties(ondoki-desktop PROPERTIES
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
)
if(QT_VERSION_MAJOR EQUAL 6)
qt_import_qml_plugins(ondoki-desktop)
qt_finalize_executable(ondoki-desktop)
endif()
The Error message for including #include <pybind11/embed.h> is common.h Python.h not found
locate python.h results in
/Applications/CLion.app/Contents/plugins/python-ce/helpers/pydev/pydevd_attach_to_process/common/python.h
/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/pydevd_attach_to_process/common/python.h
/opt/homebrew/Cellar/boost/1.76.0/include/boost/mpi/python.hpp
/opt/homebrew/Cellar/boost/1.76.0/include/boost/parameter/python.hpp
/opt/homebrew/Cellar/boost/1.76.0/include/boost/python/arg_from_python.hpp
/opt/homebrew/Cellar/boost/1.76.0/include/boost/python/converter/arg_from_python.hpp
/opt/homebrew/Cellar/boost/1.76.0/include/boost/python/converter/arg_to_python.hpp
/opt/homebrew/Cellar/boost/1.76.0/include/boost/python/converter/from_python.hpp
/opt/homebrew/Cellar/boost/1.76.0/include/boost/python/converter/obj_mgr_arg_from_python.hpp
/opt/homebrew/Cellar/boost/1.76.0/include/boost/python/converter/return_from_python.hpp
/opt/homebrew/Cellar/boost/1.76.0/include/boost/python/converter/shared_ptr_from_python.hpp
/opt/homebrew/Cellar/boost/1.76.0/include/boost/python/converter/shared_ptr_to_python.hpp
/opt/homebrew/Cellar/boost/1.76.0/include/boost/python/detail/wrap_python.hpp
/opt/homebrew/Cellar/boost/1.76.0/include/boost/python/register_ptr_to_python.hpp
/opt/homebrew/Cellar/boost/1.76.0/include/boost/python.hpp
/usr/local/include has no Python.h as has /opt/homebrew/include
a "which python3" results in /opt/homebrew/bin/python3
and my cmake parameters are the following
-GNinja
-DCMAKE_BUILD_TYPE:STRING=Debug
-DCMAKE_PROJECT_INCLUDE_BEFORE:PATH=%{IDE:ResourcePath}/package-manager/auto-setup.cmake
-DQT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable}
-DCMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX}
-DCMAKE_C_COMPILER:STRING=%{Compiler:Executable:C}
-DCMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx}
-DCMAKE_TOOLCHAIN_FILE=/Users/ahoehne/repos/vcpkg/scripts/buildsystems/vcpkg.cmake
%{CMAKE_OSX_ARCHITECTURES:DefaultFlag}
Thank you for any help or hints into the right direction.
***EDIT ***
if i include
include_directories(/opt/homebrew/Frameworks/Python.framework/Headers)
at least he seems to find the header
but results in a "expected member name or ";" after declaration specifiers --> Following the object.h file I see
typedef struct{
int slot; /* slot id, see below */
void *pfunc; /* function pointer */
} PyType_Slot;
typedef struct{
const char* name;
int basicsize;
int itemsize;
unsigned int flags;
PyType_Slot *slots; /* terminated by slot==0. */
} PyType_Spec;
on the error code line ...if I remove PyType_Slot *slots; the program compiles but I highly doubt that this is a bug and rather a problem on my side
It seems to me that the first problem is with the order of these lines:
include_directories(${PYTHON_INCLUDE_DIRS})
find_package(Python3 COMPONENTS Interpreter REQUIRED)
So you refer to an unknown yet PYTHON_INCLUDE_DIRS variable.
The second problem is the variable name itself. You are searching for Python3 package so to me the variable name should be Python3_INCLUDE_DIRS as per the FindPython3 doc
The 3rd problem is that you are searching for Interpreter only, so the headers will not be found anyway.
Summarising, please check if something like the following works:
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
include_directories(${Python3_INCLUDE_DIRS})
I want to create one .exe file from the Sunshine GitHub program, I'm new to Cmake and I build that program with its help
git clone https://github.com/loki-47-6F-64/sunshine.git --recursive
cd sunshine && mkdir build && cd build
cmake -G"Unix Makefiles" ..
mingw32-make
It builds and runs correctly and creates .exe, but works only in my system.
On other systems, it gets filesystem errors and shows the path of the system that I build it:
terminate called after throwing an instance of
'std::filesystem::__cxx11::filesystem_error' what(): filesystem
error: cannot copy file: No such file or directory
[E:/sunshine/assets/sunshine.conf] [E:/sunshine/assets/sunshine.conf]
here is its CMakeLists.txt file:
cmake_minimum_required(VERSION 3.0)
project(Sunshine)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectory(third-party/Simple-Web-Server)
set(UPNPC_BUILD_SHARED OFF CACHE BOOL "no shared libraries")
set(UPNPC_BUILD_TESTS OFF CACHE BOOL "Don't build tests for miniupnpc")
set(UPNPC_BUILD_SAMPLE OFF CACHE BOOL "Don't build samples for miniupnpc")
set(UPNPC_NO_INSTALL ON CACHE BOOL "Don't install any libraries build for miniupnpc")
add_subdirectory(third-party/miniupnp/miniupnpc)
include_directories(third-party/miniupnp)
if(WIN32)
# Ugly hack to compile with #include <qos2.h>
add_compile_definitions(
QOS_FLOWID=UINT32
PQOS_FLOWID=UINT32*
QOS_NON_ADAPTIVE_FLOW=2)
endif()
add_subdirectory(third-party/moonlight-common-c/enet)
find_package(Threads REQUIRED)
find_package(OpenSSL REQUIRED)
list(APPEND SUNSHINE_COMPILE_OPTIONS -fPIC -Wall -Wno-missing-braces -Wno-maybe-uninitialized -Wno-sign-compare)
if(WIN32)
file(
DOWNLOAD "https://github.com/TheElixZammuto/sunshine-prebuilt/releases/download/1.0.0/pre-compiled.zip" "${CMAKE_CURRENT_BINARY_DIR}/pre-compiled.zip"
TIMEOUT 60
EXPECTED_HASH SHA256=5d59986bd7f619eaaf82b2dd56b5127b747c9cbe8db61e3b898ff6b485298ed6)
file(ARCHIVE_EXTRACT
INPUT "${CMAKE_CURRENT_BINARY_DIR}/pre-compiled.zip"
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/pre-compiled)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
if(NOT DEFINED SUNSHINE_PREPARED_BINARIES)
set(SUNSHINE_PREPARED_BINARIES "${CMAKE_CURRENT_BINARY_DIR}/pre-compiled/windows")
endif()
add_compile_definitions(SUNSHINE_PLATFORM="windows")
add_subdirectory(tools) #This is temporary, only tools for Windows are needed, for now
list(APPEND SUNSHINE_DEFINITIONS APPS_JSON="apps_windows.json")
include_directories(third-party/ViGEmClient/include)
set(PLATFORM_TARGET_FILES
sunshine/platform/windows/publish.cpp
sunshine/platform/windows/misc.h
sunshine/platform/windows/misc.cpp
sunshine/platform/windows/input.cpp
sunshine/platform/windows/display.h
sunshine/platform/windows/display_base.cpp
sunshine/platform/windows/display_vram.cpp
sunshine/platform/windows/display_ram.cpp
sunshine/platform/windows/audio.cpp
third-party/ViGEmClient/src/ViGEmClient.cpp
third-party/ViGEmClient/include/ViGEm/Client.h
third-party/ViGEmClient/include/ViGEm/Common.h
third-party/ViGEmClient/include/ViGEm/Util.h
third-party/ViGEmClient/include/ViGEm/km/BusShared.h)
set(OPENSSL_LIBRARIES
libssl.a
libcrypto.a)
set(FFMPEG_INCLUDE_DIRS
${SUNSHINE_PREPARED_BINARIES}/include)
set(FFMPEG_LIBRARIES
${SUNSHINE_PREPARED_BINARIES}/lib/libavcodec.a
${SUNSHINE_PREPARED_BINARIES}/lib/libavdevice.a
${SUNSHINE_PREPARED_BINARIES}/lib/libavfilter.a
${SUNSHINE_PREPARED_BINARIES}/lib/libavformat.a
${SUNSHINE_PREPARED_BINARIES}/lib/libavutil.a
${SUNSHINE_PREPARED_BINARIES}/lib/libpostproc.a
${SUNSHINE_PREPARED_BINARIES}/lib/libswresample.a
${SUNSHINE_PREPARED_BINARIES}/lib/libswscale.a
${SUNSHINE_PREPARED_BINARIES}/lib/libx264.a
${SUNSHINE_PREPARED_BINARIES}/lib/libx265.a
${SUNSHINE_PREPARED_BINARIES}/lib/libhdr10plus.a
z lzma bcrypt libiconv.a)
list(PREPEND PLATFORM_LIBRARIES
libstdc++.a
libwinpthread.a
libssp.a
ksuser
wsock32
ws2_32
d3d11 dxgi D3DCompiler
setupapi
)
set_source_files_properties(third-party/ViGEmClient/src/ViGEmClient.cpp PROPERTIES COMPILE_DEFINITIONS "UNICODE=1;ERROR_INVALID_DEVICE_OBJECT_PARAMETER=650")
set_source_files_properties(third-party/ViGEmClient/src/ViGEmClient.cpp PROPERTIES COMPILE_FLAGS "-Wno-unknown-pragmas -Wno-misleading-indentation -Wno-class-memaccess")
else()
add_compile_definitions(SUNSHINE_PLATFORM="linux")
list(APPEND SUNSHINE_DEFINITIONS APPS_JSON="apps_linux.json")
find_package(X11 REQUIRED)
find_package(FFmpeg REQUIRED)
set(PLATFORM_TARGET_FILES
sunshine/platform/linux/publish.cpp
sunshine/platform/linux/vaapi.h
sunshine/platform/linux/vaapi.cpp
sunshine/platform/linux/misc.h
sunshine/platform/linux/misc.cpp
sunshine/platform/linux/display.cpp
sunshine/platform/linux/audio.cpp
sunshine/platform/linux/input.cpp
third-party/glad/src/egl.c
third-party/glad/src/gl.c
third-party/glad/include/EGL/eglplatform.h
third-party/glad/include/KHR/khrplatform.h
third-party/glad/include/glad/gl.h
third-party/glad/include/glad/egl.h)
set(PLATFORM_LIBRARIES
Xfixes
Xtst
xcb
xcb-shm
xcb-xfixes
Xrandr
${X11_LIBRARIES}
dl
evdev
pulse
pulse-simple
)
set(PLATFORM_INCLUDE_DIRS
${X11_INCLUDE_DIR}
/usr/include/libevdev-1.0
third-party/glad/include)
if(NOT DEFINED SUNSHINE_EXECUTABLE_PATH)
set(SUNSHINE_EXECUTABLE_PATH "sunshine")
endif()
configure_file(gen-deb.in gen-deb #ONLY)
configure_file(sunshine.service.in sunshine.service #ONLY)
endif()
add_subdirectory(third-party/cbs)
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost COMPONENTS log filesystem REQUIRED)
set(SUNSHINE_TARGET_FILES
third-party/moonlight-common-c/reedsolomon/rs.c
third-party/moonlight-common-c/reedsolomon/rs.h
third-party/moonlight-common-c/src/Input.h
third-party/moonlight-common-c/src/Rtsp.h
third-party/moonlight-common-c/src/RtspParser.c
third-party/moonlight-common-c/src/Video.h
sunshine/upnp.cpp
sunshine/upnp.h
sunshine/cbs.cpp
sunshine/utility.h
sunshine/uuid.h
sunshine/config.h
sunshine/config.cpp
sunshine/main.cpp
sunshine/main.h
sunshine/crypto.cpp
sunshine/crypto.h
sunshine/nvhttp.cpp
sunshine/nvhttp.h
sunshine/httpcommon.cpp
sunshine/httpcommon.h
sunshine/confighttp.cpp
sunshine/confighttp.h
sunshine/rtsp.cpp
sunshine/rtsp.h
sunshine/stream.cpp
sunshine/stream.h
sunshine/video.cpp
sunshine/video.h
sunshine/input.cpp
sunshine/input.h
sunshine/audio.cpp
sunshine/audio.h
sunshine/platform/common.h
sunshine/process.cpp
sunshine/process.h
sunshine/network.cpp
sunshine/network.h
sunshine/move_by_copy.h
sunshine/task_pool.h
sunshine/thread_pool.h
sunshine/thread_safe.h
sunshine/sync.h
sunshine/round_robin.h
${PLATFORM_TARGET_FILES})
set_source_files_properties(sunshine/upnp.cpp PROPERTIES COMPILE_FLAGS -Wno-pedantic)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/third-party
${CMAKE_CURRENT_SOURCE_DIR}/third-party/cbs/include
${CMAKE_CURRENT_SOURCE_DIR}/third-party/moonlight-common-c/enet/include
${CMAKE_CURRENT_SOURCE_DIR}/third-party/moonlight-common-c/reedsolomon
${FFMPEG_INCLUDE_DIRS}
${PLATFORM_INCLUDE_DIRS}
)
string(TOUPPER "x${CMAKE_BUILD_TYPE}" BUILD_TYPE)
if("${BUILD_TYPE}" STREQUAL "XDEBUG")
list(APPEND SUNSHINE_COMPILE_OPTIONS -O0 -pedantic -ggdb3)
if(WIN32)
set_source_files_properties(sunshine/nvhttp.cpp PROPERTIES COMPILE_FLAGS -O2)
endif()
else()
add_definitions(-DNDEBUG)
list(APPEND SUNSHINE_COMPILE_OPTIONS -O3)
endif()
if(NOT SUNSHINE_ASSETS_DIR)
set(SUNSHINE_ASSETS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/assets")
endif()
if(NOT SUNSHINE_CONFIG_DIR)
set(SUNSHINE_CONFIG_DIR "${SUNSHINE_ASSETS_DIR}")
endif()
if(NOT SUNSHINE_DEFAULT_DIR)
set(SUNSHINE_DEFAULT_DIR "${SUNSHINE_ASSETS_DIR}")
endif()
list(APPEND CBS_EXTERNAL_LIBRARIES
cbs)
list(APPEND SUNSHINE_EXTERNAL_LIBRARIES
libminiupnpc-static
${CBS_EXTERNAL_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
stdc++fs
enet
opus
${FFMPEG_LIBRARIES}
${Boost_LIBRARIES}
${OPENSSL_LIBRARIES}
${PLATFORM_LIBRARIES})
list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_ASSETS_DIR="${SUNSHINE_ASSETS_DIR}")
list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_CONFIG_DIR="${SUNSHINE_CONFIG_DIR}")
list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_DEFAULT_DIR="${SUNSHINE_DEFAULT_DIR}")
add_executable(sunshine ${SUNSHINE_TARGET_FILES})
target_link_libraries(sunshine ${SUNSHINE_EXTERNAL_LIBRARIES})
target_compile_definitions(sunshine PUBLIC ${SUNSHINE_DEFINITIONS})
set_target_properties(sunshine PROPERTIES CXX_STANDARD 17)
target_compile_options(sunshine PRIVATE ${SUNSHINE_COMPILE_OPTIONS})
I think in this file something makes this issue but I don't know.
This is its release file that works correctly and doesn't have my issue:
https://github.com/loki-47-6F-64/sunshine/releases/download/v0.9.0/Sunshine-Windows.zip
How can I create like this?
I fixed My problem by running CMake with one additional parameter.
cmake -G "Unix Makefiles" -DSUNSHINE_ASSETS_DIR=assets ..
exe program needs to know assets and also after that assets folder should be near the exe file like a programmer release.
On macOS 11.0, I downloaded and built g2o (https://github.com/RainerKuemmerle/g2o) and installed it using cmake --install .
I then tried to include it in my own project via CMake like this (CMakeLists.txt):
cmake_minimum_required (VERSION 3.14)
project (MY-PROJECT)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# PkgConfig to find other packages easily
find_package(PkgConfig REQUIRED)
# find required modules
pkg_check_modules(OpenCV REQUIRED opencv4)
find_package(Eigen3 REQUIRED)
find_package(OpenGL REQUIRED)
find_package(G2O REQUIRED)
message(STATUS "G2O FOUND: ")
message(STATUS ${G2O_FOUND}) # prints 1
message(STATUS "G2O INCLUDE DIRS: ")
message(STATUS ${G2O_INCLUDE_DIRS}) # prints nothing
message(STATUS "G2O Link Libraries: ")
message(STATUS ${G2O_LINK_LIBRARIES}) # prints nothing
message(STATUS "EIGEN3 INCLUDE DIRS: ")
message(STATUS ${EIGEN3_INCLUDE_DIRS}) # prints /usr/local/include/eigen3
CMake sets G2O_FOUND to 1, indicating that it successfully found g2o. However, the other two variables are not set, so the include- and library-files are not found. I solved this by adding
set(G2O_INCLUDE_DIRS
/usr/local/include)
set(G2O_LIBS
/usr/local/lib/libg2o_core.dylib
/usr/local/lib/libg2o_types_slam3d.dylib
#...
)
include_directories(
G2O_INCLUDE_DIRS
)
target_link_libraries(
MY-PROJECT
${G2O_LIBS}
)
to CMakeLists.txt, but I am still curious why CMake did find g2o but not set the variables accordingly.
why CMake did find g2o but not set the variables accordingly.
FindG2O.cmake does not set these variables, so they are not set. The variables checked for G2O_FOUND to be set are G2O_STUFF_LIBRARY AND G2O_CORE_LIBRARY AND G2O_INCLUDE_DIR AND G2O_SOLVERS_FOUND.
There is no rule that find_package has to set _LIBRARIES or _INCLUDE_DIRS variables - every package is a little different, consult that particular package. If writing FindXXX file, use interface or imported libraries instead of variables.
I am cursed with the willingness to create an application for all OS.
Unfortunately, this includes using Windows.
cmake_minimum_required(VERSION 3.17)
project(Odin)
include_directories(Odin/engine)
include_directories(Odin/uci)
include_directories(Odin/util)
# add our cmake modules under cmake/
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
#AddBOOST
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS NO)
find_package(Boost 1.74.0 REQUIRED serialization)
#ENDBOOST
message(STATUS "---------------------")
message(STATUS "Boost_FOUND: ${Boost_FOUND}")
message(STATUS "Boost_INCLUDE_DIRS: ${Boost_INCLUDE_DIRS}")
message(STATUS "Boost_LIBRARY_DIRS: ${Boost_LIBRARY_DIRS}")
message(STATUS "Boost_LIBRARIES: ${Boost_LIBRARIES}")
message(STATUS "---------------------")
# Include CPM dependency manager
include(CPM)
# enable testing
enable_testing()
# Pull doctest using CPM
cpmaddpackage("gh:onqtam/doctest#2.4.5")
# add the CMake modules for automatic test discovery so we can use
# doctest_discover_tests() CMake
set(CMAKE_MODULE_PATH "${doctest_SOURCE_DIR}/scripts/cmake"
${CMAKE_MODULE_PATH})
add_executable(Odin
Odin/engine/Odin.cc
Odin/main.cc
Odin/engine/Board.cc
Odin/engine/Figure.cc
Odin/util/Utility.cc
Odin/engine/Node.cc
Odin/engine/Link.cc
Odin/engine/Odin.h
Odin/engine/Board.h
Odin/engine/Figure.h
Odin/util/Utility.h
Odin/engine/Node.h
Odin/engine/Link.h
)
target_link_libraries(Odin PRIVATE Boost::serialization)
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native")
this cmake does not work on Windows:
The error reads:
Could NOT find Boost (missing serialization) (found 1.74.0, minimum required is "1.74.0")
If I look into the folder, there is a serialization folder. I also tried different boost versions and different IDEs (VS 2019 + CLION).
I hope someone can help me.