I\'m building my c++ program with cmake on a Mac. The compiler gives me following Error:
error: boost/filesystem.hpp: No such file or directory
I solved a similar problem by adding some lines in my CMakeLists.txt.
cmake_minimum_required(VERSION 3.5)
project(MyResource)
function(myresources out_var)
set(RESULT)
foreach(in_f ${ARGN})
file(RELATIVE_PATH src_f ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${in_f})
set(out_f "${PROJECT_BINARY_DIR}/${in_f}.c")
add_custom_command(OUTPUT ${out_f}
COMMAND myresource ${out_f} ${src_f}
DEPENDS ${in_f}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Building binary file for ${out_f}"
VERBATIM)
list(APPEND result ${out_f})
endforeach()
set(${out_var} "${result}" PARENT_SCOPE)
endfunction()
find_package(Boost COMPONENTS filesystem REQUIRED)
find_path(BOOST_FILESYSTEM_INCLUDE_DIRS boost/filesystem.hpp)
add_executable(myresource myresource.cpp)
target_link_libraries(myresource ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY})
target_include_directories(myresource PUBLIC ${BOOST_FILESYSTEM_INCLUDE_DIRS})