Skip to content

Commit

Permalink
Remove CMake variables that cannot be changed in CCMake (#588)
Browse files Browse the repository at this point in the history
This patch makes sure that the ccmake tool only shows variables that in
theory should be able to be changed prior to running make.

[ISSUE]: #587

Signed-off-by: “rianquinn” <“rianquinn@gmail.com”>
  • Loading branch information
rianquinn committed Jan 30, 2018
1 parent c181dae commit 5564363
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
38 changes: 22 additions & 16 deletions scripts/cmake/config/default.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,22 @@ add_config(
# Config
# ------------------------------------------------------------------------------

set(CMAKE_BUILD_TYPE "Release"
CACHE INTERNAL
"Defines the build type"
)

set(CMAKE_VERBOSE_MAKEFILE OFF
CACHE INTERNAL
"Enables verbose output"
)

add_config(
CONFIG_NAME CMAKE_TARGET_MESSAGES
CONFIG_TYPE BOOL
DEFAULT_VAL OFF
DEFAULT_VAL ${CMAKE_VERBOSE_MAKEFILE}
DESCRIPTION "Enables target messages"
ADVANCED
)

add_config(
Expand All @@ -319,21 +330,7 @@ add_config(
DEFAULT_VAL LAZY
DESCRIPTION "Defines the install output"
OPTIONS ALWAYS LAZY NEVER
)

add_config(
CONFIG_NAME CMAKE_BUILD_TYPE
CONFIG_TYPE STRING
DEFAULT_VAL Release
DESCRIPTION "Defines the build type"
Release Debug
)

add_config(
CONFIG_NAME CMAKE_VERBOSE_MAKEFILE
CONFIG_TYPE BOOL
DEFAULT_VAL OFF
DESCRIPTION "Enables verbose output"
ADVANCED
)

# ------------------------------------------------------------------------------
Expand Down Expand Up @@ -364,6 +361,7 @@ add_config(
DEFAULT_VAL ${BUILD_TARGET_ARCH}-vmm-elf
DESCRIPTION "VMM prefix name"
SKIP_VALIDATION
ADVANCED
)

add_config(
Expand All @@ -372,6 +370,7 @@ add_config(
DEFAULT_VAL ${BUILD_TARGET_ARCH}-userspace-${HOST_FORMAT_TYPE}
DESCRIPTION "Userspace prefix name"
SKIP_VALIDATION
ADVANCED
)

add_config(
Expand All @@ -380,6 +379,7 @@ add_config(
DEFAULT_VAL ${BUILD_TARGET_ARCH}-test-${HOST_FORMAT_TYPE}
DESCRIPTION "Test prefix name"
SKIP_VALIDATION
ADVANCED
)

set(VMM_PREFIX_PATH ${PREFIXES_DIR}/${VMM_PREFIX}
Expand Down Expand Up @@ -568,13 +568,15 @@ add_config(
CONFIG_TYPE FILEPATH
DEFAULT_VAL ${SOURCE_TOOLCHAIN_DIR}/clang_${BUILD_TARGET_ARCH}_vmm.cmake
DESCRIPTION "Path to the default cmake toolchain file for building vmm components"
ADVANCED
)

add_config(
CONFIG_NAME VMM_TEST_TOOLCHAIN_PATH
CONFIG_TYPE FILEPATH
DEFAULT_VAL ${DEFAULT_VMM_TEST_TOOLCHAIN_PATH}
DESCRIPTION "Path to the default cmake toolchain file for building vmm components for testing"
ADVANCED
)

add_config(
Expand All @@ -583,6 +585,7 @@ add_config(
DEFAULT_VAL ""
DESCRIPTION "Path to the default cmake toolchain file for building userspace components"
SKIP_VALIDATION
ADVANCED
)

add_config(
Expand All @@ -591,6 +594,7 @@ add_config(
DEFAULT_VAL ""
DESCRIPTION "Path to the default cmake toolchain file for building unit tests"
SKIP_VALIDATION
ADVANCED
)

# ------------------------------------------------------------------------------
Expand Down Expand Up @@ -793,6 +797,7 @@ add_config(
DEFAULT_VAL ${VMM_PREFIX_PATH}/bin
DESCRIPTION "Default path to vmm binaries to be loaded by bfm"
SKIP_VALIDATION
ADVANCED
)

add_config(
Expand All @@ -801,6 +806,7 @@ add_config(
DEFAULT_VAL ${VMM_PREFIX_PATH}/lib
DESCRIPTION "Default path to vmm libraries to be loaded by bfm"
SKIP_VALIDATION
ADVANCED
)

set_bfm_vmm(bfvmm DEFAULT)
Expand Down
4 changes: 4 additions & 0 deletions scripts/cmake/macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ macro(add_config)
set(multiVal OPTIONS)
cmake_parse_arguments(ARG "${options}" "${oneVal}" "${multiVal}" ${ARGN})

if(ARG_CONFIG_TYPE STREQUAL "BOOL" AND NOT ARG_DEFAULT_VAL)
set(ARG_DEFAULT_VAL OFF)
endif()

if(NOT DEFINED ${ARG_CONFIG_NAME})
set(${ARG_CONFIG_NAME} ${ARG_DEFAULT_VAL} CACHE ${ARG_CONFIG_TYPE} ${ARG_DESCRIPTION})
else()
Expand Down

0 comments on commit 5564363

Please sign in to comment.