[CMake] Forcing CMake to place targets in directories?
Michael Jackson
mike.jackson at bluequartz.net
Fri Dec 5 15:41:33 EST 2008
On Dec 5, 2008, at 12:52 PM, Robert Dailey wrote:
> On Fri, Dec 5, 2008 at 10:48 AM, David Cole <david.cole at kitware.com>
> wrote:
> The target name is the name given as the first argument to
> ADD_LIBRARY, ADD_EXECUTABLE or ADD_CUSTOM_TARGET.
>
> CMake uses the target name to create the name of the vcproj files.
>
> By default, the name of the library or executable created is based
> on the target name and any appropriate prefixes or suffixes. But, if
> you specify OUTPUT_NAME, then the name of the library or executable
> created is based on OUTPUT_NAME instead. (Nothing to do with the
> vcproj file name.)
>
> There is no way to rename or move the vcproj files. They are always
> named the same as the corresponding target and they are always in
> the CMAKE_CURRENT_BINARY_DIR corresponding to the
> CMAKE_CURRENT_SOURCE_DIR containing the CMakeLists.txt file that
> contains the ADD_LIBRARY (or other) command.
>
> I know for a fact this can be done. If you look at the Boost.CMake
> build system, you will see that for their test projects they are
> placed in a directory named "${project-name}-test", whereas the
> CMakeLists.txt file for the tests is in a differently named
> directory. I'm not sure how this is done, and CMake isn't very
> intuitive to read, especially since Boost CMake files are so complex
> so I'm having difficulty finding the code that does this.
Yes, the boost cmake files are very complex. Basically there is a
chain of "add_custom_target" and then a naming of the target, then
add_executable, then add_dependency. I am not sure where all the
vcproj files end up as I have never tried it on windows, just OS X.
You will want to start with a regression test cmake file: like boost/
libs/program_options/test/CMakeLists.txt and then start walking up the
cmake hierarchy by hand to figure out what is going on. The main set
of cmake files are in boost/tools/build/cmake/*
Good luck. Since I was the one who last updated those cmake files you
can ask me questions if you need help understanding them OR if you
want to sign up for yet another mailing list you may want to ask on
the Boost-Cmake mailing list. http://lists.boost.org/mailman/listinfo.cgi/boost-cmake
_________________________________________________________
Mike Jackson mike.jackson at bluequartz.net
BlueQuartz Software www.bluequartz.net
Principal Software Engineer Dayton, Ohio
More information about the CMake
mailing list