Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMAKE_BUILD_TYPE didn't set by default #319

Closed
rustjson opened this issue Apr 25, 2015 · 5 comments
Closed

CMAKE_BUILD_TYPE didn't set by default #319

rustjson opened this issue Apr 25, 2015 · 5 comments
Labels

Comments

@rustjson
Copy link

cmake ../ && cmake -L
Specify --help for usage, or press the help button on the CMake GUI.
-- Cache values
BUILD_TESTING:BOOL=ON
CMAKE_BUILD_TYPE:STRING=
CMAKE_INSTALL_DIR:PATH=/usr/local/lib/cmake/RapidJSON
CMAKE_INSTALL_PREFIX:PATH=/usr/local
DOC_INSTALL_DIR:PATH=/usr/local/share/doc/RapidJSON
GTEST_INCLUDE_DIR:PATH=GTEST_INCLUDE_DIR-NOTFOUND
GTEST_SOURCE_DIR:PATH=GTEST_SOURCE_DIR-NOTFOUND
INCLUDE_INSTALL_DIR:PATH=/usr/local/include
LIB_INSTALL_DIR:STRING=/usr/local/lib
RAPIDJSON_BUILD_DOC:BOOL=ON
RAPIDJSON_BUILD_EXAMPLES:BOOL=ON
RAPIDJSON_BUILD_TESTS:BOOL=ON
RAPIDJSON_BUILD_THIRDPARTY_GTEST:BOOL=OFF
RAPIDJSON_HAS_STDSTRING:BOOL=OFF

But this works fine:

cmake -DCMAKE_BUILD_TYPE=Debug ../ && cmake -L
-- Cache values
BUILD_TESTING:BOOL=ON
CMAKE_BUILD_TYPE:STRING=Debug
CMAKE_INSTALL_DIR:PATH=/usr/local/lib/cmake/RapidJSON
CMAKE_INSTALL_PREFIX:PATH=/usr/local
......
@rustjson
Copy link
Author

I think It should display RelWithDebInfo by default, because this:

///CMakeLists.txt

SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Build Type")

@miloyip miloyip added the build label Apr 26, 2015
@miloyip
Copy link
Collaborator

miloyip commented Apr 28, 2015

@jollyroger, what you do think?

@jollyroger
Copy link
Contributor

according to this thread, setting CMAKE_BUILD_TYPE is just not enough. In the latter messages the proposed way to set default build type is:

if(NOT CMAKE_BUILD_TYPE)
  set(CMAKE_BUILD_TYPE "Release" CACHE STRING
      "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif(NOT CMAKE_BUILD_TYPE)

Note that in this case using FORCE and setting the docstring is mandatory.

@rustjson
Copy link
Author

@jollyroger This works. But that thread didn't explan why we need to use "FORCE". can you ?

@jollyroger
Copy link
Contributor

@Red-wolf-s-husband, AFAIR, it just doesn't work without FORCE option, this is easy to try. This has no any side effects since we check beforehand if this option is defined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants