Can't include spdlog as submodule #2327
Unanswered
DeveloperChaseLewis
asked this question in
Q&A
Replies: 2 comments
-
Usually, See: https://cmake.org/cmake/help/latest/command/add_subdirectory.html After Example: +add_subdirectory(submodules/spdlog)
+
target_include_directories(Valkyrie
PUBLIC "../submodules/glfw/include"
PUBLIC "../submodules/glm"
PUBLIC "../submodules/entt/single_include"
- PUBLIC "../submodules/spdlog/include"
PUBLIC ${Vulkan_INCLUDE_DIRS}
)
target_link_libraries(Valkyrie
"${CMAKE_BINARY_DIR}/submodules/glfw/src/glfw3.lib"
${Vulkan_LIBRARIES}
+PRIVATE spdlog::spdlog_header_only
) |
Beta Was this translation helpful? Give feedback.
0 replies
-
Just make sure there is no confusion in terminology, as add_subdirectory
does not IMPORT but rather builds with the project from source. Contrary
add_library(spdlogger SHARED IMPORTED ) does import spdlog into projected
from a prebuilt package without building it from source
…On Wed, Mar 30, 2022 at 10:17 PM tt4g ***@***.***> wrote:
Usually, add_subdirectory() is used to import another CMake project (e.g.
add_subdirectory(submodules/spdlog)).
Note that only subdirectories can be included.
See: https://cmake.org/cmake/help/latest/command/add_subdirectory.html
After add_subdirectory() imports the spdlog project, an
spdlog::spdlog_header_only (header-only target) CMake target is defined.
Example:
+add_subdirectory(submodules/spdlog)+
target_include_directories(Valkyrie
PUBLIC "../submodules/glfw/include"
PUBLIC "../submodules/glm"
PUBLIC "../submodules/entt/single_include"- PUBLIC "../submodules/spdlog/include"
PUBLIC ${Vulkan_INCLUDE_DIRS}
)
target_link_libraries(Valkyrie
"${CMAKE_BINARY_DIR}/submodules/glfw/src/glfw3.lib"
${Vulkan_LIBRARIES}+PRIVATE spdlog::spdlog_header_only
)
—
Reply to this email directly, view it on GitHub
<#2327 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AE4UHIRY4IXLYX3W7ZQQIZDVCUKNDANCNFSM5SD4QXIQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
A bit new to CMake but the instructions in the ReadMe.md don't work because find_package won't work when using a package as a submodule (cmake is so awesome ...). Every other library I am using can just include the header files and the built lib from
${CMAKE_BINARY_DIR}/submodules/package/src
Spdlog is the only exception where I don't even get the headers included for some reason I can't quite explain.
Anyone know how to get spdlog to work as a submodule?
Beta Was this translation helpful? Give feedback.
All reactions