[CMake] Adding configuration for a new compiler
Hendrik Sattler
post at hendrik-sattler.de
Fri Apr 11 07:09:12 EDT 2008
Zitat von Brad King <brad.king at kitware.com>:
> Hendrik Sattler wrote:
>> The C compiler test fails because CMake insists on createing
>> testCCompiler.c.r30 and there doesn't seem to be way to tell it to
>> not include the source file name extension (here: .c) into the
>> object file name.
>
> It's undocumented because I didn't anticipate anyone would need to
> change the default, but the variable is
> "CMAKE_<lang>_OUTPUT_EXTENSION_REPLACE". Try adding
>
> SET(CMAKE_C_OUTPUT_EXTENSION_REPLACE 1)
> SET(CMAKE_CXX_OUTPUT_EXTENSION_REPLACE 1)
>
> to your compiler configuration file.
That works, at least for the file name. There are some remaining
problems, though:
That compiler can only handle Windows-like paths (it tries to be smart
but isn't) and thus only works with the "NMake Makefiles" generator.
To specify the output _directory_, the option -dir can be used and
luckily, cmake provides a <OBJECT_DIR>. However, the content of that
is not a Windows path but a cmake path (containing '/' instead of '\').
Additionally, the compiler test assumes that the compiler creates the
directory itself (it doesn't) but that can be worked around in
CMAKE_C_COMPILE_OBJECT. Better would be to not assume that.
It is possible to fix this for CMake-2.6?
HS
More information about the CMake
mailing list