[cmake-developers] [CMake 0014057]: Add GROUP_SOURCES property for targets
Mantis Bug Tracker
mantis at public.kitware.com
Tue Apr 2 10:56:45 EDT 2013
The following issue has been SUBMITTED.
======================================================================
http://public.kitware.com/Bug/view.php?id=14057
======================================================================
Reported By: szx
Assigned To:
======================================================================
Project: CMake
Issue ID: 14057
Category: CMake
Reproducibility: N/A
Severity: feature
Priority: normal
Status: new
======================================================================
Date Submitted: 2013-04-02 10:56 EDT
Last Modified: 2013-04-02 10:56 EDT
======================================================================
Summary: Add GROUP_SOURCES property for targets
Description:
It would be nice if there was a property that automatically grouped target's
soruce files on directory basis, similar to what source_group() does.
set_target_properties(foo PROPERTIES GROUP_SOURCES ON)
Additional Information:
At the moment this can be achieved with e.g. a macro like this:
function(group_target_sources target)
get_target_property(sources ${target} SOURCES)
foreach(file ${sources})
get_filename_component(path "${file}" ABSOLUTE)
get_filename_component(path "${path}" PATH)
if(file MATCHES "${PROJECT_BINARY_DIR}")
file(RELATIVE_PATH path ${PROJECT_BINARY_DIR} "${path}")
else()
file(RELATIVE_PATH path ${PROJECT_SOURCE_DIR} "${path}")
endif()
string(REGEX REPLACE "/" "\\\\" win_path "${path}")
source_group("${win_path}" REGULAR_EXPRESSION "${path}/[^/\\]+\\..*")
endforeach()
endfunction()
(in fact this is what I use in personal projects)
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2013-04-02 10:56 szx New Issue
======================================================================
More information about the cmake-developers
mailing list