fehim kus
fehim kus

Reputation: 21

Why Cmake does not accept my build type command but taking with cli?

I am using fecth_content in my CMake something like:

FetchContent_Declare(
    Logger
    GIT_REPOSITORY https://github.com/fehimkus/MessageLogger.git
    GIT_TAG main
)
FetchContent_MakeAvailable(Logger)

It is pretty straightforward. Right? But i want to give some arguments the Logger's Cmake, like build on release mode. For that I am writing on the main Cmake something like that;

set(CMAKE_BUILD_TYPE Release)

But submodule (fetch_content stuff) does not take this and is built with DEBUG mode.

Then I wrote with cli that;

mkdir -p build && cmake -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF

Surprisingly it is worked! I did not understand why. If anyone can help me about this issue I will be very appreciated.

Solution EDIT: @Tsyvarev was right. I should wrote it frstly

Upvotes: 0

Views: 44

Answers (0)

Related Questions