1

CMAKE_<LANG>_COMPILE_OBJECT is a variable to set compile rules.

set("<CMAKE_MY_COMPILER> <DEFINES> <INCLUDES> -o <OBJECT> -c <FLAGS> <SOURCE>")

This variable is set in CMake<LANG>Information.cmake. The source file is build and produces an object file build/hello_world.o. CMake is expecting the compiler to produce a different object name.

[ 95%] Building object CMakeFiles/hello_world.dir/src/hello_world.my.o
[100%] Linking executable hello_world
[100%] Built target hello_world

How can I remove the source file extension my from the object name in the build step?

linuxUser123
  • 529
  • 3
  • 17
  • Have you tried modifying the variable? Have you looked into using CMake's `string(REGEX ... )` [command](https://cmake.org/cmake/help/v3.12/command/string.html#regular-expressions) to manipulate the contents of this variable? – Kevin Sep 17 '19 at 18:39
  • this is not a cached variable nor a global variable. I don't think I have access to it. – linuxUser123 Sep 17 '19 at 21:37

1 Answers1

0

Set the following variable:

set(CMAKE_<LANG>_OUTPUT_EXTENSION_REPLACE 1)

I set this in the file CMakeLANGInformation.cmake for a new cmake language.

Patrick
  • 2,243
  • 2
  • 23
  • 32