[CMake] Forcing CMake to place targets in directories?

David Cole david.cole at kitware.com
Fri Dec 5 11:48:13 EST 2008


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.


HTH,
David



On Fri, Dec 5, 2008 at 11:33 AM, Robert Dailey <rcdailey at gmail.com> wrote:

> The documentation says:
>
> OUTPUT_NAME sets the real name of a target when it is built and can be used
> to help create two targets of the same name even though CMake requires
> unique logical target names.
>
> The target being built here seems to be the VCPROJ when using "cmake -G"
> for visual studio 2008. Can someone help me understand the purpose of
> OUTPUT_NAME if I am mistaken?
>
> On Thu, Dec 4, 2008 at 10:32 PM, Mike Jackson <mike.jackson at bluequartz.net
> > wrote:
>
>> Nope. Sorry.
>>
>> Sent from my iPod
>>
>> On Dec 4, 2008, at 22:55, "Robert Dailey" <rcdailey at gmail.com> wrote:
>>
>> I wanted my vcproj files to be placed in "test_projects". Any idea how I
>> can make this happen?
>>
>> On Thu, Dec 4, 2008 at 8:30 PM, Mike Jackson <<mike.jackson at bluequartz.net>
>> mike.jackson at bluequartz.net> wrote:
>>
>>> CMAKE_CURRENT_SOURCE_DIR denotes your source tree and NOT the build
>>> tree. Are you building in your source tree instead of using a
>>> dedicated build directory?
>>>
>>> To answer your code you are setting the output directory of where the
>>> executable will be placed in a directory called "test_projects" at the
>>> top level of your build tree.
>>>
>>> Mike Jackson
>>>
>>>
>>> On Thu, Dec 4, 2008 at 7:40 PM, Robert Dailey < <rcdailey at gmail.com>
>>> rcdailey at gmail.com> wrote:
>>> > Hi,
>>> >
>>> > I'm trying to use set_target_properties() to make CMake place generated
>>> > vcproj files in a subdirectory of ${CMAKE_CURRENT_SOURCE_DIR}. This
>>> isn't
>>> > working and I'm not sure what I'm doing wrong. Below is what I'm doing:
>>> >
>>> >             set( test_project_name ${project_name}_test_${test_name} )
>>> >             project( ${test_project_name} )
>>> >             source_group( "" ${file} )
>>> >             add_executable( ${test_project_name} ${file} )
>>> >             set_target_properties( ${test_project_name} PROPERTIES
>>> > OUTPUT_NAME test_projects/${test_project_name} )
>>> >
>>> > My project should be getting placed inside of a test_projects
>>> subdirectory,
>>> > right?
>>> >
>>> > _______________________________________________
>>> > CMake mailing list
>>> > <CMake at cmake.org>CMake at cmake.org
>>> > <http://www.cmake.org/mailman/listinfo/cmake>
>>> http://www.cmake.org/mailman/listinfo/cmake
>>> >
>>>
>>
>> _______________________________________________
>> CMake mailing list
>> CMake at cmake.org
>> http://www.cmake.org/mailman/listinfo/cmake
>>
>>
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081205/6e39861c/attachment.htm>


More information about the CMake mailing list