0

cmake version : 3.18.5 MinGW Makefiles Host : windows target : ppc compiler : windriver

I want to create two different executables with different flags. for execample i want to create one executable with flag(-tPPCE) and another with flag(-tPPCEV), These flags define the type of hardware. If i try to set this value in their respective CMakelists.txt with

    set_target_properties(app1 PROPERTIES CMAKE_C_FLAGS -tPPCE)
    set_target_properties(app2 PROPERTIES CMAKE_C_FLAGS -tPPCEV)

it is not working.

It is working only if i set this value in the toolchain file where i have set all other flags.

  • [That answer](https://stackoverflow.com/a/28773403/3440745) for the duplicate question describes how to add compiler flags for a single target. It uses `target_compile_options` command. – Tsyvarev Mar 10 '21 at 07:58

1 Answers1

1

You can use target_compile_options method:

target_compile_options(app1 PRIVATE "-tPPCE")
target_compile_options(app2 PRIVATE "-tPPCEV")
for_stack
  • 14,584
  • 2
  • 20
  • 34