-
Notifications
You must be signed in to change notification settings - Fork 115
Open
Description
Congratulations with the book!
I did not read it, I am looking for one for teaching, hence I am trying to compile blindly. Got stuck with an error:
examples/ch04/fig04_11.cpp:5:10: fatal error: zip_file.hpp: No such file or directory
5 | #include "zip_file.hpp"zip_file.hpp is not in the repo, where can we get it?
I hastily came up with CMake script to compile it (something like this would be nice to have in the repo):
cmake_minimum_required(VERSION 3.15)
project(CXX20ForProgrammers LANGUAGES CXX)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # for clang-tidy
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_EXTENSIONS OFF)
add_subdirectory("examples/libraries/fmt")
add_subdirectory("examples/libraries/GSL")
file(GLOB sources "${CMAKE_CURRENT_SOURCE_DIR}/examples/ch*/*.cpp")
foreach(source ${sources})
file(STRINGS ${source} hasmain REGEX ".+\ main\(.+\).+")
if (hasmain)
get_filename_component(name "${source}" NAME_WLE)
if (NOT ${name} STREQUAL "fig04_07_with_error")
add_executable(${name} ${source})
file(STRINGS ${source} usesfmt REGEX ".+fmt/format.+")
if (usesfmt)
target_include_directories(${name} PRIVATE "examples/libraries/fmt/include")
target_link_libraries(${name} PRIVATE fmt)
endif()
file(STRINGS ${source} usesgsl REGEX ".+gsl/gsl.+")
if (usesgsl)
target_include_directories(${name} PRIVATE "examples/libraries/GSL/include")
endif()
endif()
endif(hasmain)
endforeach()Then used the usual cmake dance:
cmake -S . -B build -G Ninja
cmake --build buildMetadata
Metadata
Assignees
Labels
No labels