[CMake] targetname_BINARY_DIR?

Pau Garcia i Quiles pgquiles at elpauer.org
Tue Jan 18 17:12:55 EST 2011


On Tue, Jan 18, 2011 at 12:42 PM, David Cole <david.cole at kitware.com> wrote:
> There is nothing like that... Unless the target has had its directory
> property *set* before you make the get_property call.
>
> Why do you need this? What's your use case where the name of a target is
> known, but the name of its containing project is unknown (presumably)...?

I'm generating wrapper scripts to start the examples in the Wt
(http://webtoolkit.eu ) tarball with just a double-click (the examples
require parameters; the wrappers provide some sensible defaults). I
wanted to generate the wrapper script in the binary directory but the
examples do not do "project(examplename)".

I've resorted to generate the wrapper scripts in PROJECT_BINARY_DIR.

> On Mon, Jan 17, 2011 at 9:47 PM, Pau Garcia i Quiles <pgquiles at elpauer.org>
> wrote:
>>
>> Hello,
>>
>> If I use:
>>
>> project( blah )
>>
>> that creates variables blah_SOURCE_DIR and blah_BINARY_DIR.
>>
>> Does anything like that exist for a *target* ? I've managed to emulate
>> targetname_SOURCE_DIR with:
>>
>>  get_target_property(${name}_SOURCEFILES ${name} SOURCES)
>>  list(GET ${name}_SOURCEFILES 0 ${name}_FIRST_SOURCEFILE )
>>  get_source_file_property(${name}_SUBDIR_FULLPATH
>> ${${name}_FIRST_SOURCEFILE} LOCATION)
>>  string(REPLACE ${WT_SOURCE_DIR}/examples/ "" ${name}_SUBDIRANDSOURCE
>> ${${name}_SUBDIR_FULLPATH})
>>  string(REPLACE /${${name}_FIRST_SOURCEFILE} "" ${name}_SUBDIR
>> ${${name}_SUBDIRANDSOURCE})
>>
>> However, I don't know how to emulate targetname_BINARY_DIR. I tried with:
>>
>>  get_target_property(${name}_RUNTIME_OUTPUT_DIRECTORY ${name}
>> RUNTIME_OUTPUT_DIRECTORY)
>>
>> But I get NOTFOUND :-(
>>
>> Thank you
>>
>> --
>> Pau Garcia i Quiles
>> http://www.elpauer.org
>> (Due to my workload, I may need 10 days to answer)
>> _______________________________________________
>> 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
>
>



-- 
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)


More information about the CMake mailing list