[CMake] Re: Add subdirectories in visual projects
Philip Lowman
philip at yhbt.com
Sat Feb 23 14:56:46 EST 2008
Olivier Tournaire wrote:
> Sorry, I made a mistake in my previous mail. In fact, I would like to
> have this :
>
> Project__
> |
> |___ Header Files__
> | |
> | |___ folder1__
> | | |
> | |
> |__file1_1.hpp
> | |
> |__file1_2.hpp
> | |___ folder2__
> | |
> |
> |__file2_1.hpp
> |
> |__file2_2.hpp
> |
> |___ Source Files__
> |___ folder1__
> | |
> |
> |__file1_1.cpp
> |
> |__file1_2.cpp
> |___ folder2__
> |
>
> |__file2_1.cpp
>
> |__file2_2.cpp
Olivier,
This should be possible to do with the code pasted below BUT due to Bug
#4057 the particular folder hierarchy you have defined above will ONLY
work in CVS versions of CMake, not in 2.4.8.
http://www.cmake.org/Bug/view.php?id=4057
If you need a solution that works in 2.4.8 you will have to use unique
folder names. In other words, you can't have "folder1" appear in more
than one place.
You can download prebuilt nightly CVS builds for Win32 from the link below:
http://www.cmake.org/files/vCVS
(for today's build you would download cmake-2.5.20080223-win32-x86.zip
<http://www.cmake.org/files/vCVS/cmake-2.5.20080223-win32-x86.zip>
extract and run CMakeSetup from within the bin folder)
#=========================================
SET(group1_hdrs file1_1.h file1_2.h)
SET(group2_hdrs file2_1.h file2_2.h)
SET(group1_srcs file1_1.cc file1_2.cc)
SET(group2_srcs file2_1.cc file2_2.cc)
SOURCE_GROUP("Header Files\\folder1" FILES ${group1_hdrs})
SOURCE_GROUP("Header Files\\folder2" FILES ${group2_hdrs})
SOURCE_GROUP("Source Files\\folder1" FILES ${group1_srcs})
SOURCE_GROUP("Source Files\\folder2" FILES ${group2_srcs})
ADD_EXECUTABLE(foo
${group1_hdrs} ${group1_srcs} ${group2_hdrs} ${group2_srcs})
More information about the CMake
mailing list