Skip to content

Instantly share code, notes, and snippets.

@igilham
Created December 9, 2014 12:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igilham/3672f49e9afefc4ae080 to your computer and use it in GitHub Desktop.
Save igilham/3672f49e9afefc4ae080 to your computer and use it in GitHub Desktop.
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