On 03/30/2015 03:36 PM, Petr Bena wrote:
Hi Nils,
Great! Could you please give me some mininal example and perhaps add
it to documentation page which is now kind of vague? From what is
written there, I suppose that this variable changes the runtime output
directory, but for all targets since it's set and until it's changed?
eg. if I have huge CMakeLists.txt file that includes other CMake files
using add_subdirectory I would wrap all add_subdirectory directives
with change to this variable? like:
RUNTIME_OUTPUT_DIRECTORY("extensions/")
add_subdirectory("extension/ext1")
# Now I should reset it back to what it was?
RUNTIME_OUTPUT_DIRECTORY("WHAT DO I PUT HERE??")
CMAKE_RUNTIME_OUTPUT_DIRECTORY is a variable.
You can set it with e.g.:
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
You could unset it again with e.g.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY)
Regular cmake variables are inherited into sub-directories.
CMAKE_RUNTIME_OUTPUT_DIRECTORY is read at every add_executable() and
add_library() call to initialize the RUNTIME_OUTPUT_DIRECTORY_PROPERTY
[1] of the newly created target.
So to revise your example the following should work (assuming the
sub-directory itself does not override the defaults):
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}/extensions)
add_subdirectory(extension/ext1)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY)
Nils
[1] www.cmake.org/cmake/help/v3.2/prop_tgt/RUNTIME_OUTPUT_DIRECTORY.html
--
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:
http://public.kitware.com/mailman/listinfo/cmake