1

I am trying to build using Cmake on macOS Big Sur. Following is the makefile.

CMAKE_MINIMUM_REQUIRED(VERSION 3.5)

#------------------------------------------------------------------------------#
#                             Compiler setup
#------------------------------------------------------------------------------#

IF(CMAKE_SYSTEM_NAME=Windows)
  SET(ADDITIONAL_FLAGS "-DWIN32")
ENDIF(CMAKE_SYSTEM_NAME=Windows)

SET(CMAKE_CXX_COMPILER "g++")
SET(CMAKE_CXX_FLAGS "-std=c++17 -g -Wall -Wno-uninitialized")
SET(CMAKE_CXX_FLAGS_DEBUGALL "${CMAKE_CXX_FLAGS} -fsanitize=address,undefined -pthread" )
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -O3 -DOPTIMIZE -pthread" ${ADDITIONAL_FLAGS} )
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3 -DNDEBUG -DOPTIMIZE -pthread" ${ADDITIONAL_FLAGS} )
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} -O3 -g -DNDEBUG -DOPTIMIZE -pthread" ${ADDITIONAL_FLAGS} )

#SET(CMAKE_BUILD_TYPE Debug)
IF(NOT CMAKE_BUILD_TYPE)
  SET(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build: Debug Release RelWithDebInfo" FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)

#------------------------------------------------------------------------------#
#                             Required libraries
#------------------------------------------------------------------------------#

SET(Boost_DEBUG "ON")
SET(Boost_USE_STATIC_LIBS "ON")
SET(HOME_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "")
SET(CMAKE_MODULE_PATH ${HOME_DIR}/CMake)

FIND_PACKAGE(Boost COMPONENTS filesystem program_options timer chrono REQUIRED)
SET(EXTERNAL_INCLUDES ${Boost_INCLUDES})
SET(EXTERNAL_LIBRARIES ${Boost_LIBRARIES})

FIND_PACKAGE(Eigen3 3.3.4)
INCLUDE_DIRECTORIES(${EIGEN3_INCLUDE_DIRS})

#------------------------------------------------------------------------------#
#                             Directories for compiled libraries
#------------------------------------------------------------------------------#

INCLUDE_DIRECTORIES(src/Mesh)
INCLUDE_DIRECTORIES(src/Quadrature)
INCLUDE_DIRECTORIES(src/Common)
INCLUDE_DIRECTORIES(src/HybridCore)
INCLUDE_DIRECTORIES(src/Plot)
INCLUDE_DIRECTORIES(src/DDRCore)

ADD_SUBDIRECTORY(src/Mesh)
ADD_SUBDIRECTORY(src/Quadrature)
ADD_SUBDIRECTORY(src/Common)
ADD_SUBDIRECTORY(src/HybridCore)
ADD_SUBDIRECTORY(src/Plot)
ADD_SUBDIRECTORY(src/DDRCore)

#------------------------------------------------------------------------------#
#                             Directories for schemes
#------------------------------------------------------------------------------#

INCLUDE_DIRECTORIES(Schemes)
ADD_SUBDIRECTORY(Schemes)

While running make command I am getting

fatal error: 'boost/multi_array.hpp' file not found
#include <boost/multi_array.hpp>

I have boost installed with the help of brew. I also tried this https://stackoverflow.com/a/32929012/8499104 to verify my path is correct. Still not able to figure out why this is not able to find this library.

  • How does `EXTERNAL_INCLUDES` interact with your targets? –  Oct 25 '21 at 15:54
  • The variable contained list of Boost include directories is named `Boost_INCLUDE_DIRS`: https://cmake.org/cmake/help/latest/module/FindBoost.html. The variable which you use - `Boost_INCLUDES` - is most likely empty. – Tsyvarev Oct 25 '21 at 15:59
  • Just a little thing: a CMakeLists.txt file is *not* a makefile. cmake can read your CMakeLists.txt to create a makefile. It can also create a ninja.build, for instance. Or a VS project, or an XCode project. – sweenish Oct 25 '21 at 16:04
  • @Tsyvarev I tried Boost_INCLUDE_DIRS but that didn't work as well. Also, the source from where I got this project, claims that the code is running. – user8499104 Oct 25 '21 at 17:13
  • This is the source: https://github.com/jdroniou/HArDCore2D-release @Frank I will have to see that. But for now I am trying to make it run. – user8499104 Oct 25 '21 at 17:14
  • @user8499104: On Stack Overflow we expect relevant code to be in the **question post** itself, link to the code is not sufficient. Without viewing into the usage of `EXTERNAL_INCLUDES` variable (which should contain required include directories) it is impossible to say what you are doing wrong. See also [mcve]. – Tsyvarev Oct 25 '21 at 18:07

0 Answers0