Author: akhaldi
Date: Wed Aug 28 21:37:54 2013
New Revision: 59860
URL:
http://svn.reactos.org/svn/reactos?rev=59860&view=rev
Log:
[CMAKE/VS]
* Introduce the support for organizing the solution into a hierarchy of folders that
matches our codebase layout.
* You can enable this feature by adding -DUSE_FOLDER_STRUCTURE=1 to your configure phase
(the VSSolution one).
* Based on a patch by Yuntian Zhang with my improvements.
CORE-7412
Modified:
trunk/reactos/cmake/CMakeMacros.cmake
trunk/reactos/cmake/msvc.cmake
Modified: trunk/reactos/cmake/CMakeMacros.cmake
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/cmake/CMakeMacros.cmake?re…
==============================================================================
--- trunk/reactos/cmake/CMakeMacros.cmake [iso-8859-1] (original)
+++ trunk/reactos/cmake/CMakeMacros.cmake [iso-8859-1] Wed Aug 28 21:37:54 2013
@@ -345,6 +345,32 @@
_add_executable(${name} ${ARGN})
add_clean_target(${name})
endfunction()
+elseif(USE_FOLDER_STRUCTURE)
+ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+ string(LENGTH ${CMAKE_SOURCE_DIR} CMAKE_SOURCE_DIR_LENGTH)
+
+ function(add_custom_target name)
+ _add_custom_target(${name} ${ARGN})
+ string(SUBSTRING ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR_LENGTH} -1
CMAKE_CURRENT_SOURCE_DIR_RELATIVE)
+ set_property(TARGET "${name}" PROPERTY FOLDER
"${CMAKE_CURRENT_SOURCE_DIR_RELATIVE}")
+ endfunction()
+
+ function(add_library name)
+ _add_library(${name} ${ARGN})
+ get_target_property(_target_excluded ${name} EXCLUDE_FROM_ALL)
+ if(_target_excluded AND ${name} MATCHES "^lib.*")
+ set_property(TARGET "${name}" PROPERTY FOLDER
"Importlibs")
+ else()
+ string(SUBSTRING ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR_LENGTH} -1
CMAKE_CURRENT_SOURCE_DIR_RELATIVE)
+ set_property(TARGET "${name}" PROPERTY FOLDER
"${CMAKE_CURRENT_SOURCE_DIR_RELATIVE}")
+ endif()
+ endfunction()
+
+ function(add_executable name)
+ _add_executable(${name} ${ARGN})
+ string(SUBSTRING ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR_LENGTH} -1
CMAKE_CURRENT_SOURCE_DIR_RELATIVE)
+ set_property(TARGET "${name}" PROPERTY FOLDER
"${CMAKE_CURRENT_SOURCE_DIR_RELATIVE}")
+ endfunction()
endif()
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
Modified: trunk/reactos/cmake/msvc.cmake
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/cmake/msvc.cmake?rev=59860…
==============================================================================
--- trunk/reactos/cmake/msvc.cmake [iso-8859-1] (original)
+++ trunk/reactos/cmake/msvc.cmake [iso-8859-1] Wed Aug 28 21:37:54 2013
@@ -45,6 +45,9 @@
if(MSVC_IDE)
add_compile_flags("/MP")
+ if(NOT DEFINED USE_FOLDER_STRUCTURE)
+ set(USE_FOLDER_STRUCTURE FALSE)
+ endif()
endif()
if(${_MACHINE_ARCH_FLAG} MATCHES X86)