[CMake] Quick question about set and substitutions
J Decker
d3ck0r at gmail.com
Thu Sep 16 21:42:49 EDT 2010
On Thu, Sep 16, 2010 at 6:30 PM, Ryan Pavlik <rpavlik at iastate.edu> wrote:
> Why are you trying to do this before the project command?
To result in a shorthand that I don't HAVE to copy and paste; because
definition of compiler requirements for passing definitions that are
string literals is lacking?
You can set the
> target name to be something different from the project name, and you can
> even set the output name of the executable/library to be different than what
> would be automatically set by default from the target name.
Sure... but I don't; so it would be a reasonable shorthand within this
source domain.
(I've done
> this, to embed the platform into the code and/or output name)
> My guess: you've done a lot of work with makefiles and the C preprocessor.
> It looks like you're overthinking it - CMake is a reasonably high-level
> scripting language, not a macro language or preprocessor.
Maybe :) That's really the question though - how is this not what I want?
> Could you share a high-level intended behavior with the list so we might be
> able to give you a more satisfying answer?
In the end, during compilation I want to define a 'variable' that IS
the name of the library itself. That name is usually only passed to
the linker. different compilers have different syntax for defining
string literals like
#define TARGET_NAME "MyLibrary.Dll"
I don't want to define the name in two places, I want it to be
definitively the project name, because why would it be any other name
in a new development?
gcc[ld] -DTARGET_NAME="\"libsack.so\"" -o libsack.so <sources>
wcc[wlink] -DTARGET_NAME="libsack.so" -o sack.dll <sources>
/* I'm not sure about this one... it might be like gcc, but it may be
version dependant also */
mc[link] -DTARGET_NAME="libsack.so" -o sack.dll <sources>
Since there is no definition in CMAKE for the quote to use to define a
string literal to a definition...
I think is the syntax to define a macro on the command line that has
spaces, not strings... really probably openwatcom is broken.
"-DOtherMacro 1+2=3"
More information about the CMake
mailing list