[CMake] General question
Steven Truppe
workbench at gmx.at
Tue Jun 4 11:45:06 EDT 2019
Hi everyone,
i have the following code:
set(ALL_LIBS "glad;glfw")
# WITH_LIB_GLAD
option(WITH_LIB_GLAD 1)
option(WITH_LIB_GLAD_EXAMPLE_BASIC "Build the basic Glad example (default:0)" 1)
option(WITH_LIB_GLAD_EXAMPLE_SECOND "Build the second Glad example (default:0)" 1)
# WITH_LIB_GLFW
option(WITH_LIB_GLFW 1)
option(WITH_LIB_GLFW_EXAMPLE_CBASIC "Build the basic GLFW C example (default:1)" 1)
option(WITH_LIB_GLFW_EXAMPLE_CPPBASIC "Build the basic GLFW C example (default:1)" 1)
################
## bsBuildLib ##
################
macro(bsBuildLibs libs)
foreach(lib ${libs})
message(STATUS "Searching incude path for lib: <${lib}>")
bsIncludeLibs(${lib})
bsBuildLibExamples(${lib})
endforeach()
endmacro()
###################
## bsIncludeLibs ##
###################
macro(bsIncludeLibs lib)
message(STATUS "INCLUDE library ${lib}")
include("lib_${lib}")
endmacro()
########################
## bsBuildLibExamples ##
########################
macro(bsBuildLibExamples lib)
# get all examples
foreach(_var in VARIABLES)
string(TOUPPER ${lib} lib_upper)
if(_var MATCHES "WITH_LIB_${lib_upper}_EXAMPLE_([A-Za-z]+)")
message(STATUS "Found example: ${CMAKE_MATCH_0}")
endif()
endforeach()
endmacro()
The final result should be that i get the name of the examples, like for
glad BASIC and SECOND and for glfw CBASIC and CPPBASIC.
best regards!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190604/b55547a3/attachment-0001.html>
More information about the CMake
mailing list