vcpkg/ports/qt5-base/install_qt.cmake
Maurice Kalinowski 60db384541 Fix PATH modification on Linux/Mac (#6083)
* Fix lineendings

Some files were checked in as always CRLF.

* [qt5-base] Fix path separators on non Windows (fixes #5246)

Use vcpkg_add_to_path instead of cmake environment manipulation.
2019-04-15 05:00:14 -07:00

63 lines
2.2 KiB
CMake

function(install_qt)
cmake_parse_arguments(_bc "DISABLE_PARALLEL" "" "" ${ARGN})
if (_bc_DISABLE_PARALLEL)
set(NUMBER_OF_PROCESSORS "1")
else()
if(DEFINED ENV{NUMBER_OF_PROCESSORS})
set(NUMBER_OF_PROCESSORS $ENV{NUMBER_OF_PROCESSORS})
else()
execute_process(
COMMAND nproc
OUTPUT_VARIABLE NUMBER_OF_PROCESSORS
)
string(REPLACE "\n" "" NUMBER_OF_PROCESSORS "${NUMBER_OF_PROCESSORS}")
string(REPLACE " " "" NUMBER_OF_PROCESSORS "${NUMBER_OF_PROCESSORS}")
endif()
endif()
if(CMAKE_HOST_WIN32)
vcpkg_find_acquire_program(JOM)
set(INVOKE "${JOM}" /J ${NUMBER_OF_PROCESSORS})
else()
find_program(MAKE make)
set(INVOKE "${MAKE}" -j${NUMBER_OF_PROCESSORS})
endif()
vcpkg_find_acquire_program(PYTHON3)
get_filename_component(PYTHON3_EXE_PATH ${PYTHON3} DIRECTORY)
vcpkg_add_to_path(PREPEND "${PYTHON3_EXE_PATH}")
set(_path "$ENV{PATH}")
message(STATUS "Package ${TARGET_TRIPLET}-dbg")
vcpkg_add_to_path(PREPEND "${CURRENT_INSTALLED_DIR}/debug/bin")
vcpkg_execute_required_process(
COMMAND ${INVOKE}
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg
LOGNAME build-${TARGET_TRIPLET}-dbg
)
vcpkg_execute_required_process(
COMMAND ${INVOKE} install
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg
LOGNAME package-${TARGET_TRIPLET}-dbg
)
message(STATUS "Package ${TARGET_TRIPLET}-dbg done")
message(STATUS "Package ${TARGET_TRIPLET}-rel")
set(ENV{PATH} "${_path}")
vcpkg_add_to_path(PREPEND "${CURRENT_INSTALLED_DIR}/bin")
vcpkg_execute_required_process(
COMMAND ${INVOKE}
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel
LOGNAME build-${TARGET_TRIPLET}-rel
)
vcpkg_execute_required_process(
COMMAND ${INVOKE} install
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel
LOGNAME package-${TARGET_TRIPLET}-rel
)
message(STATUS "Package ${TARGET_TRIPLET}-rel done")
set(ENV{PATH} "${_path}")
endfunction()