[CMake] Default visual studio filters

Michael Jackson mike.jackson at bluequartz.net
Fri Feb 25 12:58:41 EST 2011


I have the following macro that I use:


MACRO (cmp_IDE_SOURCE_PROPERTIES SOURCE_PATH HEADERS SOURCES)
    STRING(REPLACE "/" "\\\\" source_group_path ${SOURCE_PATH}  )
    source_group(${source_group_path} FILES ${HEADERS} ${SOURCES})
ENDMACRO (cmp_IDE_SOURCE_PROPERTIES NAME HEADERS SOURCES INSTALL_FILES)

#Example Usage
set(SRCS Foo.cpp bar.cpp)
set(HDRS Foo.h   bar.h)
cmp_IDE_SOURCE_PROPERTIES( "Source/Lib" "${HDRS}" "${SRCS}")
add_library( foolib  ${SRCS} ${HDRS})

and in Visual Studio I get Foo.cpp bar.cpp foo.h bar.h all in the same "filter"/Folder thingie. Is that what you are looking for? 

___________________________________________________________
Mike Jackson                      www.bluequartz.net
Principal Software Engineer       mike.jackson at bluequartz.net 
BlueQuartz Software               Dayton, Ohio

On Feb 25, 2011, at 12:42 PM, Aaron_Wright at selinc.com wrote:

> I was curious about an answer to this question. I don't think source and 
> header files should be separated either. It's just a nag, but if there was 
> an easy fix, I'd jump on it.
> 
> ---
> Aaron Wright
> 
> 
> 
> 
> From:   Orcun Gokbulut <madorcun at gmail.com>
> To:     cmake at cmake.org
> Date:   02/23/2011 07:48 AM
> Subject:        [CMake] Default visual studio filters
> Sent by:        cmake-bounces at cmake.org
> 
> 
> 
> Hello cmake users,
> 
> We are porting our visual studio based build system to cmake and its 
> allmost done with some minor problems.
> 
> One of the minor problem is default visual c++ filters (source groups)
> I don't like (actually hate) visual c++'s default *.cpp *.h filters. (Not 
> the filter feature but the default filters) They make navigation hard at 
> solution explorer and I want source and header file to be listed next to 
> each other. 
> Therefore I want all of my source files to be not included in a filter and 
> remove "Source Files" and "Header Files" filters.  I have read the 
> documentation and exprimented with SOURCE_GROUP command but I can not 
> figure out how to remove default *.cpp and *.h source groups. 
> 
> Also I'm going to add a special regex filter that combines auto generated 
> source codes in to a filter. Something like
> source_group (ZPP REGULAR_EXPRESSION ".*\\.zpp")
> 
> 
> How can I do that ?
> 
> Thanks every one,
> Orçun_______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at: 
> http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
> 
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list