Hello,
I'm a new user. I want to use cmake for our
cross-platform software.
I'm trying to generate a vcproj project with
sub source groups but it seems to be impossible with the current
version of cmake.
I coded this, but I can't have sub source groups
with it :
#
-------------------------------------------------------------------------------------
# Global description for the source
files
#
# Note : The source file with no
folder must be put at the top of the list
#
-------------------------------------------------------------------------------------
SET(VKKERNEL_GLOBALS_SOURCES_DESC
"Clock
Management"
vkClock.h
vkClockManager.h
vkSystemTimeSource.h
vkTimeSource.h
source/vkClock.cpp
source/vkClockManager.cpp
source/vkSystemTimeSource.cpp
source/vkTimeSource.cpp
"Containers"
vkArray.h
vkBinaryTree.h
vkDictionary.h
vkHash.h
vkList.h
vkLockFreeQueue.h
)
#
-------------------------------------------------------------------------------------
# This loop will :
# - add the source files to the
source list
# - sort every source file into its
project folder (works only for .vcproj projects)
#
-------------------------------------------------------------------------------------
FOREACH (SOURCE_DESCRIPTION
${VKKERNEL_GLOBALS_SOURCES_DESC})
IF
(${SOURCE_DESCRIPTION} MATCHES "[A-Za-z]*.(h|cpp)$")
# this is a source file
#add it to the source list
SET (VKKERNEL_SOURCES ${VKKERNEL_SOURCES}
${SOURCE_DESCRIPTION})
# add it to the current folder list
IF (NOT CUR_FOLDER_LIST)
# this the first item in the folder list,
so no "|" at the start
SET (CUR_FOLDER_LIST
${SOURCE_DESCRIPTION})
ELSE (NOT CUR_FOLDER_LIST)
SET (CUR_FOLDER_LIST
${CUR_FOLDER_LIST}|${SOURCE_DESCRIPTION})
ENDIF (NOT CUR_FOLDER_LIST)
ELSE
(${SOURCE_DESCRIPTION} MATCHES "[A-Za-z]*.(h|cpp)$")
# this is a source folder
# create the source folder
IF (CURRENT_FOLDER)
# this is the first time we meet a source
folder
SOURCE_GROUP("${CURRENT_FOLDER}"
"${CUR_FOLDER_LIST}")
SET (CUR_FOLDER_LIST "")
ENDIF (CURRENT_FOLDER)
SET
(CURRENT_FOLDER ${SOURCE_DESCRIPTION})
ENDIF(${SOURCE_DESCRIPTION} MATCHES "[A-Za-z]*.(h|cpp)$")
ENDFOREACH(SOURCE_DESCRIPTION
${VKKERNEL_GLOBALS_SOURCES_DESC})
# create the last source
folder
SOURCE_GROUP("${CURRENT_FOLDER}"
"${CUR_FOLDER_LIST}")
ADD_LIBRARY(vkKernel SHARED
${VKKERNEL_SOURCES})
I looked to the sources of cmake and I found
that SourceGroup can have children group but it seems to be not
used. Did I miss something ?
If there is no sub source group support in cmake currently, I plan to
add it myself with this syntax in the config :
SET(VKKERNEL_GLOBALS_SOURCES_DESC
"Source
Files::Clock Management"
vkClock.h
vkClockManager.h
vkSystemTimeSource.h
vkTimeSource.h
source/vkClock.cpp
source/vkClockManager.cpp
source/vkSystemTimeSource.cpp
source/vkTimeSource.cpp
"Source
Files::Containers"
vkArray.h
vkBinaryTree.h
vkDictionary.h
vkHash.h
vkList.h
vkLockFreeQueue.h
) Any help will be
much appreciated.
Thank you.
Sylvain Benner |
_______________________________________________ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake