Код: Выделить всё
/build
/engine
/include
/engine.h
/src
/enginepch.h
...
/vendor
/header_only
/include
/header1.h
...
/need_to_compile
...
CMakeLists.txt
/testbed
/stuffForTestingEngine
CMakeLists.txt
CMakeLists.txt
Код: Выделить всё
./engine/CMakeLists.txtКод: Выделить всё
project(engine)
# config "need_to_compile
# ...and I configured everything that needed compilation here: glm, glad, openal, libpng and glfw.
# linking
add_library(engine SHARED
src/core/application.cpp
src/core/engine.cpp
# etc. These are all my source files.
)
add_library(engine::engine ALIAS engine)
target_include_directories(engine PUBLIC
${engine_SOURCE_DIR}/include
)
target_include_directories(engine PRIVATE
${PROJECT_SOURCE_DIR}/vendor
)
target_precompile_headers(engine PRIVATE src/enginepch.h)
target_link_libraries(engine PUBLIC
glfw
png
openal
glad
glm::glm
)
Как только я попытался включить любую библиотеку header_only в свой файл pch, она сломалась. Например:
Код: Выделить всё
# This works!
#include
# These didn't.
#include
#include
#include
Я пытался включить эти библиотеки header_only в CMakeLists, либо связав псевдоним, либо добавив include_directory, но это не сработало.
Я подозреваю, что мои настройки неверны или что у меня есть фатальное непонимание того, что делает CMake/компилятор.
Подробнее здесь: https://stackoverflow.com/questions/784 ... sing-cmake
Мобильная версия