Hi all,
there was a mail with this issues a view years ago, but without a result:
https://cmake.org/pipermail/cmake/2014-October/058963.html
<https://cmake.org/pipermail/cmake/2014-October/058963.html>
quote:
————————————————————————————————————————————-
Ninja generator sets the name to objectpath.d
cmGlobalNinjaGenerator::EncodeDepfileSpace(objectFileName + ".d");
WindRiver sets the dep file name to objectDir/SourceName.d, so the ".obj" in
"DEP_FILE = path/BaseName.c.obj.d" must be removed
Armcc just uses base name in the same directory as the command runs,
"BaseName.d". -depend_dir= can be used to control the directory for C but not
asm.
The workaround is to patch the generated build.ninja
A proper solution is using new variables similar to above. (Just examples, not
figured out <ARCH> etc)
WindRiver (not added to CMake):
SET (CMAKE_<LANG>_<COMPILER_ID>_DEPFILE_PATTERN
<OBJECT_DIR>/<SOURCE_FILE_NAME>.d )
Armcc (RVDS patch exists for CMake):
SET (CMAKE_DEPFILE_FLAGS_C -depend_dir=<OBJECT_FULL_DIR> --depend_format=unix)
SET (CMAKE_C_ARMCC_DEPFILE_PATTERN <OBJECT_FULL_DIR>/<SOURCE_BASE_NAME>.d )
SET (CMAKE_DEPFILE_FLAGS_ASM --depend_format=unix)
SET (CMAKE_ASM_ARMCC_DEPFILE_PATTERN <SOURCE_BASE_NAME>.d )
Note: <OBJECT> is replaced in CMAKE_C_ARMCC_DEPFILE_PATTERN (but adding a
semicolon), but not <OBJECT_DIR> (as that is evaluated after FLAGS/DEFINES) so
it is a little more than just add new variables.
The workaround for armcc could therefore not use CMAKE_DEPFILE_FLAGS_C, the
-depend_dir flag was added to normal FLAGS
———————————————————————————————-
I have the same problem with a GHS compiler. We can’t control the name of the
generated *.d file while compile step.
My questions are:
1.) Is ist possible to change the object or/and the dependency file name
generated for ninja?
2.) Why generates cmake the objectname as sourcefilename.{c,cpp}.obj?
I would expect to build the name as GNU make do, something like that:
DEP:=$(SRC:.cpp=.d)
OBJ:=$(SRC:.cpp=.obj)
Claus Klein
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake-developers