[CMake] adding program suffix
Eric Noulard
eric.noulard at gmail.com
Mon Mar 11 04:24:15 EDT 2013
2013/3/11 Yngve Inntjore Levinsen <yngve.levinsen at gmail.com>:
> On 11/03/13 08:57, Chandan Choudhury wrote:
>
>
> Hi,
>
> Do you mean how to add it to the CMakeLists.txt files? I sometimes use the
> target property OUTPUT_NAME:
>
> add_executable(mybin ${sources})
> set_target_properties(mybin PROPERTIES OUTPUT_NAME "mybin${BINARY_POSTFIX}")
>
> Then, you can add your own suffix with:
>
> cmake -DBINARY_POSTFIX=<suffix> ../
>
> If there is any "official" cmake variables to use for this I am not aware of
> it (but I am no cmake developer neither).
I think Chandan meant "globally" for all executables.
That's the purpose of CMAKE_EXECUTABLE_SUFFIX
as already pointed out by Michael.
see : cmake --help-variable "CMAKE_EXECUTABLE_SUFFIX"
Now it doesn't seems to work for Chandan.
I guess the variable is forcibly written by "CMakeGenericSystem.cmake"
during early CMake startup.
So that you cannot overwrite its value on the command line.
try to add "variable_watch(CMAKE_EXECUTABLE_SUFFIX)" at the very top
of main CMakeLists.txt
You may try to do that from within the CMakeLists.txt after the
"project(...)" statement (or enable_language)
--
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org
More information about the CMake
mailing list