require setting default_build_type

This commit is contained in:
Radovan Bast
2017-02-04 12:25:31 +01:00
parent 88ca810194
commit 319ce56308
18 changed files with 33 additions and 6 deletions

View File

@@ -45,7 +45,7 @@ def autogenerated_notice():
return '\n'.join(s)
def gen_setup(config, relative_path, setup_script_name):
def gen_setup(config, default_build_type, relative_path, setup_script_name):
"""
Generate setup script.
"""
@@ -76,7 +76,7 @@ def gen_setup(config, relative_path, setup_script_name):
rest = ' '.join(opt.split()[1:]).strip()
options.append([first, rest])
options.append(['--type=<TYPE>', 'Set the CMake build type (debug, release, or relwithdeb) [default: release].'])
options.append(['--type=<TYPE>', 'Set the CMake build type (debug, release, relwithdebinfo, minsizerel) [default: {0}].'.format(default_build_type)])
options.append(['--generator=<STRING>', 'Set the CMake build system generator [default: Unix Makefiles].'])
options.append(['--show', 'Show CMake command and exit.'])
options.append(['--cmake-executable=<CMAKE_EXECUTABLE>', 'Set the CMake executable [default: cmake].'])
@@ -118,7 +118,7 @@ def gen_setup(config, relative_path, setup_script_name):
return s
def gen_cmakelists(project_name, min_cmake_version, relative_path, modules):
def gen_cmakelists(project_name, min_cmake_version, default_build_type, relative_path, modules):
"""
Generate CMakeLists.txt.
"""
@@ -137,9 +137,14 @@ def gen_cmakelists(project_name, min_cmake_version, relative_path, modules):
s.append('\n# do not rebuild if rules (compiler flags) change')
s.append('set(CMAKE_SKIP_RULE_DEPENDENCY TRUE)')
build_type_capitalized = {'debug': 'Debug',
'release': 'Release',
'relwithdebinfo': 'RelWithDebInfo',
'minsizerel': 'MinSizeRel'}
s.append('\n# if CMAKE_BUILD_TYPE undefined, we set it to Debug')
s.append('if(NOT CMAKE_BUILD_TYPE)')
s.append(' set(CMAKE_BUILD_TYPE "Debug")')
s.append(' set(CMAKE_BUILD_TYPE "{0}")'.format(build_type_capitalized[default_build_type]))
s.append('endif()')
if len(modules) > 0: