How should we use FetchContent_Declare and FetchContent_MakeAvailable to include glad2?
I've tried the following but it doesn't build:
if ((NOT DEFINED BT_GLAD_LIBS) OR (NOT DEFINED BT_GLAD_INCLUDE_DIRS))
FetchContent_Declare(
glad
GIT_REPOSITORY https://github.com/Dav1dde/glad.git
GIT_TAG glad2
GIT_PROGRESS TRUE
)
message("####################### IN GLAD ###############################")
set(GLAD_PROFILE "core" CACHE STRING "OpenGL profile")
set(GLAD_API "gl=" CACHE STRING "API type/version pairs, like \"gl=3.2,gles=\", no version means latest")
set(GLAD_GENERATOR "c" CACHE STRING "Language to generate the binding for")
# set(glad_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
FetchContent_MakeAvailable(glad)
set(BT_GLAD_LIBS glad)
set(BT_GLAD_INCLUDE_DIRS ${glad_SOURCE_DIR}/include)
endif ()
Which results in the following output:
[cmake] ####################### IN GLAD ###############################
[cmake] -- Populating glad
[cmake] -- Configuring done (0.0s)
[cmake] -- Generating done (0.0s)
[cmake] -- Build files have been written to: D:/mario/build/_deps/glad-subbuild
[cmake] [0/7] Performing update step for 'glad-populate'
[cmake] [1/7] No patch step for 'glad-populate'
[cmake] [3/7] No configure step for 'glad-populate'
[cmake] [4/7] No build step for 'glad-populate'
[cmake] [5/7] No install step for 'glad-populate'
[cmake] [6/7] No test step for 'glad-populate'
[cmake] [7/7] Completed 'glad-populate'
How should we use
FetchContent_Declare
andFetchContent_MakeAvailable
to include glad2?I've tried the following but it doesn't build:
Which results in the following output: