Hi,

On 06.12.18 09:50, Andy wrote:

> If I call "cmake ." it write: "Warning:Debug"
> Debug is default and I must call "cmake . -DCMAKE_BUILD_TYPE=Release"
> for release?

That depends on the generator used. Some generators require the build
type at configuration time, some at build time. For example, the Visual
Studio generator should generate files containing both Debug and Release
configurations, and neither of your code blocks should be run.

Ideally, you should never do anything directly that depends on the build
type, but only prepare things. So rather than

if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
endif()

you'd use

set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")

so generators that handle multiple build types at the same time can work.

   Simon

Attachment: signature.asc
Description: OpenPGP digital signature

-- 

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

Reply via email to