diff options
Diffstat (limited to 'eclass/cmake-utils.eclass')
| -rw-r--r-- | eclass/cmake-utils.eclass | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass index 4d87b85acb2..c53eeae608e 100644 --- a/eclass/cmake-utils.eclass +++ b/eclass/cmake-utils.eclass @@ -148,7 +148,7 @@ _check_build_dir() { # files should be located. # # For installing binary doins "${CMAKE_BUILD_DIR}/${PN}" - if [[ -n "${CMAKE_IN_SOURCE_BUILD}" ]]; then + if [[ -n ${CMAKE_IN_SOURCE_BUILD} ]]; then # we build in source dir CMAKE_BUILD_DIR="${CMAKE_USE_DIR}" elif [[ ${CMAKE_USE_DIR} = ${WORKDIR} ]]; then @@ -247,10 +247,11 @@ _modify-cmakelists() { || die "${LINENO}: failed to disable hardcoded settings" # NOTE Append some useful summary here - echo ' -MESSAGE(STATUS "<<< Gentoo configuration >>> -Build type: ${CMAKE_BUILD_TYPE} -Install path: ${CMAKE_INSTALL_PREFIX}\n")' >> CMakeLists.txt + cat >> CMakeLists.txt <<- _EOF_ + MESSAGE(STATUS "<<< Gentoo configuration >>> + Build type: ${CMAKE_BUILD_TYPE} + Install path: ${CMAKE_INSTALL_PREFIX}\n") + _EOF_ } # @FUNCTION: enable_cmake-utils_src_configure @@ -263,7 +264,7 @@ enable_cmake-utils_src_configure() { _check_build_dir init # check if CMakeLists.txt exist and if no then die - if [[ ! -e "${CMAKE_USE_DIR}"/CMakeLists.txt ]] ; then + if [[ ! -e ${CMAKE_USE_DIR}/CMakeLists.txt ]] ; then eerror "I was unable to locate CMakeLists.txt under:" eerror "\"${CMAKE_USE_DIR}/CMakeLists.txt\"" eerror "You should consider not inheriting the cmake eclass." @@ -285,21 +286,21 @@ enable_cmake-utils_src_configure() { fi # Prepare Gentoo override rules (set valid compiler, append CPPFLAGS) - local build_rules="${TMPDIR}"/gentoo_rules.cmake -cat > ${build_rules} << _EOF_ -SET (CMAKE_C_COMPILER $(type -P $(tc-getCC)) CACHE FILEPATH "C compiler" FORCE) -SET (CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C compile command" FORCE) -SET (CMAKE_CXX_COMPILER $(type -P $(tc-getCXX)) CACHE FILEPATH "C++ compiler" FORCE) -SET (CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <DEFINES> ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C++ compile command" FORCE) -_EOF_ + local build_rules=${T}/gentoo_rules.cmake + cat > "${build_rules}" <<- _EOF_ + SET (CMAKE_C_COMPILER $(type -P $(tc-getCC)) CACHE FILEPATH "C compiler" FORCE) + SET (CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C compile command" FORCE) + SET (CMAKE_CXX_COMPILER $(type -P $(tc-getCXX)) CACHE FILEPATH "C++ compiler" FORCE) + SET (CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <DEFINES> ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C++ compile command" FORCE) + _EOF_ # Common configure parameters (invariants) - local common_config="${TMPDIR}"/gentoo_common_config.cmake + local common_config=${T}/gentoo_common_config.cmake local libdir=$(get_libdir) -cat > ${common_config} << _EOF_ -SET (LIB_SUFFIX ${libdir/lib} CACHE STRING "library path suffix" FORCE) -_EOF_ - [[ -n ${CMAKE_NO_COLOR} ]] && echo 'SET (CMAKE_COLOR_MAKEFILE OFF CACHE BOOL "pretty colors during make" FORCE)' >> ${common_config} + cat > "${common_config}" <<- _EOF_ + SET (LIB_SUFFIX ${libdir/lib} CACHE STRING "library path suffix" FORCE) + _EOF_ + [[ -n ${CMAKE_NO_COLOR} ]] && echo 'SET (CMAKE_COLOR_MAKEFILE OFF CACHE BOOL "pretty colors during make" FORCE)' >> "${common_config}" # Convert mycmakeargs to an array, for backwards compatibility if [[ $(declare -p mycmakeargs) != "declare -a mycmakeargs="* ]]; then @@ -342,6 +343,7 @@ enable_cmake-utils_src_compile() { # @DESCRIPTION: # Function for building the package. Automatically detects the build type. # All arguments are passed to emake: +# "cmake-utils_src_make -j1" can be used to work around parallel make issues. cmake-utils_src_make() { debug-print-function ${FUNCNAME} "$@" |
