J Decker wrote:
You can define a variable to define the base of the sources....
set( SOURCE_ROOT /some/path )
could be set relative to the current cmake path per cmake that uses those
souces... and then just prefix it
add_library(my_lib
${SOURCE_ROOT}/src/a.c
${SOURCE_ROOT}/include/a.h
)
Thanks, but that’s approximately exactly what I’m trying to avoid doing. I
cheat a little, in that I have a macro that will prepend a prefix to every
element of a list. My motivation is avoiding situations where I add the prefix
to the files but forget to add the prefix when I call
target_include_directories or suchlike.
I’m not sure anything trickier is workable in the CMake model, however. For
example, hacking CMAKE_CURRENT_SOURCE_DIR might make sense for file paths, but
if I then call add_subdirectory should it be rooted at the CMakeList directory
or the source root directory.
--
Andrew
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake