Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
CMake add_sources Macro
set(SRCS "")
macro (add_sources)
foreach (_src ${ARGN})
if (_relPath)
list (APPEND SRCS "${_src}")
else()
list (APPEND SRCS "${_src}")
endif()
endforeach()
if (_relPath)
# propagate SRCS to parent directory
set (SRCS ${SRCS} PARENT_SCOPE)
endif()
endmacro()
add_sources(main.cpp inc.h)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.