From 449d1f620aa846409495a970a3858050951c6e46 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 31 Aug 2012 11:59:30 +0200 Subject: [PATCH] Don't set empty CMAKE_TOOLCHAIN_FILE or CMAKE_BUILD_TYPE The CMake Visual Studio 10 generator generates an include() for the empty CMAKE_TOOLCHAIN_FILE, causing the errors in the bug. There may be other remaining errors to cause the Windows CMake build to fail with that generator, but this patch is an improvement anyway - there is no point in setting empty strings as values for those variables. Task-number: QTBUG-27087 Change-Id: I68cce9e3dce07835db5f42777ac02d440f90f967 Reviewed-by: Brad King Reviewed-by: Stephen Kelly --- src/corelib/Qt5CTestMacros.cmake | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/corelib/Qt5CTestMacros.cmake b/src/corelib/Qt5CTestMacros.cmake index 9c786c5..d4a0b72 100644 --- a/src/corelib/Qt5CTestMacros.cmake +++ b/src/corelib/Qt5CTestMacros.cmake @@ -1,4 +1,14 @@ +set(BUILD_OPTIONS_LIST) + +if (CMAKE_BUILD_TYPE) + list(APPEND BUILD_OPTIONS_LIST "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}") +endif() + +if (CMAKE_TOOLCHAIN_FILE) + list(APPEND BUILD_OPTIONS_LIST "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}") +endif() + macro(expect_pass _dir) string(REPLACE "(" "_" testname "${_dir}") string(REPLACE ")" "_" testname "${testname}") @@ -8,7 +18,7 @@ macro(expect_pass _dir) "${CMAKE_CURRENT_BINARY_DIR}/${_dir}" --build-generator ${CMAKE_GENERATOR} --build-makeprogram ${CMAKE_MAKE_PROGRAM} - --build-options "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}" "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" + --build-options "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}" ${BUILD_OPTIONS_LIST} ) endmacro() @@ -42,6 +52,6 @@ macro(expect_fail _dir) "${CMAKE_CURRENT_BINARY_DIR}/failbuild/${_dir}/build" --build-generator ${CMAKE_GENERATOR} --build-makeprogram ${CMAKE_MAKE_PROGRAM} - --build-options "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}" "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" + --build-options "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}" ${BUILD_OPTIONS_LIST} ) endmacro() -- 2.7.4