[CMake] How could I control generated object files name?

Alexander Neundorf a.neundorf-work at gmx.net
Tue Aug 11 16:17:35 EDT 2009


On Friday 07 August 2009, huaiguang ye wrote:
> hi,
>
> How could I control my generated object files name? Because I found in my
> cmake project, *.c/*.cc/*.cpp will generated to object
> *.c.o/*.cc.o/*.cpp.o, but I really want to get *.o. Such as: $ find . -name
> "*.o"
> ./src/CMakeFiles/RSLcommon.dir/BasicDdm.cc.o
> ./src/CMakeFiles/RSLcommon.dir/DoubleArray.cc.o
> ./src/CMakeFiles/RSLcommon.dir/RslBoardInfo.cc.o
> ./src/CMakeFiles/RSLcommon.dir/RslMath.cc.o
> ./src/CMakeFiles/RSLcommon.dir/RslRebootReasons.cc.o
> ./src/CMakeFiles/RSLcommon.dir/RslStatusCode.cc.o
> ./src/CMakeFiles/RSLcommon.dir/RslSubsystemState.cc.o
> ./src/CMakeFiles/RSLcommon.dir/defstr.cc.o
> ./src/CMakeFiles/RSLcommon.dir/test1.c.o
> ./src/CMakeFiles/RSLcommon.dir/test2.cpp.o
>
>
> And my CMakeLists.txt in src is below:
>
> add_library(RSLcommon STATIC
>            BasicDdm.cc
>            DoubleArray.cc
>        RslBoardInfo.cc
>        RslMath.cc
>        RslRebootReasons.cc
>        RslStatusCode.cc
>        RslSubsystemState.cc
>        defstr.cc
>        test1.c
>        test2.cpp)
>
> I don't know where is the wrong. And my cmake version is 2.6.4.
>
> Another question is if I don't want to generated static or shared library
> neither, I only want to compiling source code(*.cc) to object files(*.o),
> what should I do?

Why do you want that ?
There is a cmake variable for that...

Alex


More information about the CMake mailing list