0

I want to add my build type to cmake to call cmake like this:

cmake -DCMAKE_BUILD_TYPE=mytype

I've written strings to my CMakeLists.txt:

set(CMAKE_CXX_FLAGS_DEBUG "-fPIC -o0 -g") set(CMAKE_CXX_FLAGS_MYTYPE "-fPIC -o0 -g -m32) set(CMAKE_CXX_FLAGS_RELEASE "-fPIC -o3)

But cmake uses compiler flags which were wrote in CMAKE_CXX_FLAGS_DEBUG.

What I should do to add my build type correctly?

Rikitikitavi
  • 133
  • 1
  • 8
  • See [this](https://cmake.org/Wiki/CMake_FAQ#How_can_I_extend_the_build_modes_with_a_custom_made_one_.3F) for more details. – skypjack Aug 03 '17 at 07:11
  • 2
    Possible duplicate of [How to add a custom build type to cmake ? (targetting make)](https://stackoverflow.com/questions/11437692/how-to-add-a-custom-build-type-to-cmake-targetting-make) – skypjack Aug 03 '17 at 07:12
  • 1
    It's the same quesion, but that question doesn't give answer. – Rikitikitavi Aug 03 '17 at 07:23
  • Actually it has a good answer that also contains a few links to online resources from which you can get even more details. What's wrong exactly with it? – skypjack Aug 03 '17 at 09:15
  • Current information is insufficient for determine what is wrong. Provide [mcve]. – Tsyvarev Aug 03 '17 at 22:25

1 Answers1

-1

I've fond soulution. set function must be before project() directive.

Rikitikitavi
  • 133
  • 1
  • 8