What CMake generation parameter determines CMAKE_CXX_STANDARD_LIBRARIES ?

I had some trouble getting the correct value for CMAKE_CXX_STANDARD_LIBRARIES when doing my CMake generation via a Qt Creator ‘kit’.

With the following generation command I ended up with those libraries set to: kernel32.lib & user32.lib which is not valid for the platform I was targeting: WinCE/arm.

C:\Program Files\CMake\bin\cmake.exe -S C:/Projects/multitest -B C:/Projects/build-multitest-VisualStudio2012-arm "-DCMAKE_GENERATOR:STRING=Visual Studio 12 2013" "-DCMAKE_GENERATOR_PLATFORM:STRING=Am335xPetraSDK" "-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=C:/Qt/Tools/QtCreator/share/qtcreator/package-manager/auto-setup.cmake" "-DCMAKE_CXX_COMPILER:STRING=C:/Program Files (x86)/Windows CE Tools/SDKs/Am335xPetraSDK/Sdk/bin/i386/ARM/cl.exe" "-DCMAKE_C_COMPILER:STRING=C:/Program Files (x86)/Windows CE Tools/SDKs/Am335xPetraSDK/Sdk/bin/i386/ARM/cl.exe" "-DCMAKE_PREFIX_PATH:STRING=C:/QtAEPP/AEPPQTSDK" "-DPLATFORM_DEFINITION:STRING=WINCE" "-DQT_QMAKE_EXECUTABLE:STRING=C:/QtAEPP/AEPPQTSDK/bin/qmake.exe" "-DCMAKE_TRY_COMPILE_TARGET_TYPE:STRING=STATIC_LIBRARY" "-DSYSTEM_NAME:STRING=WindowsCE" "-DCMAKE_SYSTEM_PROCESSOR:STRING=arm" "-DCMAKE_SYSTEM_VERSION:STRING=8.0" "-DCMAKE_EXE_LINKER_FLAGS:STRING=/SUBSYSTEM:WINDOWSCE,8.00 /ENTRY:mainCRTStartup" "-DWINCE_DIR:STRING=C:/WINCE800" "-DCMAKE_CXX_FLAGS:STRING=/DWIN32 /D_WINDOWS /W4 /WX /Gm-" "-DPETRASDK_DIR:STRING=C:/Program Files (x86)/Windows CE Tools/SDs/Am335xPetraSDK/Sdk" in C:\Projects\build-multitest-VisualStudio2012-arm

When I added a toolchain file the libraries changed to the correct value: coredll.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib
All I added to that generation line was:
-DMAKE_TOOLCHAIN_FILE:FILEPATH=C:/Projects/AEPP/cmake/toolchains/WEC2013_Am335xPetraSDK_Toolchain.cmake

where the toolchain has these contents:

if (${CMAKE_GENERATOR} STREQUAL "Ninja" OR ${CMAKE_GENERATOR} STREQUAL "NMake Makefiles")
    set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
endif()

set(CMAKE_SYSTEM_NAME WindowsCE)
set(CMAKE_SYSTEM_VERSION 8.0)
set(CMAKE_SYSTEM_PROCESSOR arm)

set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWSCE,8.00 /ENTRY:mainCRTStartup")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DWIN32 /D_WINDOWS /W4 /WX /Gm-")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd /Zi /Ob0 /Od /RTC1")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD /O2 /Ob2 /GS- /DNDEBUG")

set(BUILD_TESTING false)

add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS)
set(PLATFORM_DEFINITION WINCE)

I apologize for all the noise in these commands, but can anyone tell me what the toolchain file adds that would completely change the standard libraries that get used? I would have thought the CMAKE_GENERATOR and CMAKE_GENERATOR_PLATFORM (i.e. -G and -A) were the only things that mattered here.

I’d try stripping out the flags in the file one by one.