diff options
author | David Cole <david.cole@kitware.com> | 2010-10-01 21:23:53 (GMT) |
---|---|---|
committer | David Cole <david.cole@kitware.com> | 2010-10-02 18:31:02 (GMT) |
commit | fd3249e11afeb38284ee8e2012134de4d410c92b (patch) | |
tree | 360c3c1fb3993ca3e25a3de663093889a2187ba3 /CMakeLists.txt | |
parent | e6ac0aacf6c3ce17141870e252fda77d994782d3 (diff) | |
download | CMake-fd3249e11afeb38284ee8e2012134de4d410c92b.zip CMake-fd3249e11afeb38284ee8e2012134de4d410c92b.tar.gz CMake-fd3249e11afeb38284ee8e2012134de4d410c92b.tar.bz2 |
New USE_FOLDERS property OFF by default. (#3796)
Visual Studio Express editions do not support solution folders,
so default behavior should be as if USE_FOLDERS global property
is OFF.
Also, allow folder names to be the same as target names: internally,
use a prefix to distinguish folder GUIDs from target GUIDs. Add
a target and folder with the same name in the ExternalProject
test to exercise this code.
For CMake itself, provide a new option CMAKE_USE_FOLDERS that
defaults to ON so that Visual Studio users get a nicely organized
CMake project. Express edition users will have to turn off the
CMAKE_USE_FOLDERS option in order to build CMake in the VS Express
IDE.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index dec502b..f5ec0f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -173,15 +173,33 @@ MACRO(CMAKE_SETUP_TESTING) ENDMACRO(CMAKE_SETUP_TESTING) +# Provide a way for Visual Studio Express users to turn OFF the new FOLDER +# organization feature. Default to ON for non-Express users. Express users must +# explicitly turn off this option to build CMake in the Express IDE... +# +OPTION(CMAKE_USE_FOLDERS "Enable folder grouping of projects in IDEs." ON) +MARK_AS_ADVANCED(CMAKE_USE_FOLDERS) + + +#----------------------------------------------------------------------- +# a macro that only sets the FOLDER target property if it's +# "appropriate" +#----------------------------------------------------------------------- MACRO(CMAKE_SET_TARGET_FOLDER tgt folder) - # Really, I just want this to be an "if(TARGET ${tgt})" ... - # but I'm not sure that our min req'd., CMake 2.4.5 can handle - # that... so I'm just activating this for now, with a version - # compare, and only for MSVC builds. - IF(MSVC) - IF(NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.8) - SET_PROPERTY(TARGET "${tgt}" PROPERTY FOLDER "${folder}") + IF(CMAKE_USE_FOLDERS) + SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON) + + # Really, I just want this to be an "if(TARGET ${tgt})" ... + # but I'm not sure that our min req'd., CMake 2.4.5 can handle + # that... so I'm just activating this for now, with a version + # compare, and only for MSVC builds. + IF(MSVC) + IF(NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.8) + SET_PROPERTY(TARGET "${tgt}" PROPERTY FOLDER "${folder}") + ENDIF() ENDIF() + ELSE() + SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS OFF) ENDIF() ENDMACRO(CMAKE_SET_TARGET_FOLDER) |