# What CMake generation parameter determines CMAKE\_CXX\_STANDARD\_LIBRARIES ?

**URL:** https://discourse.cmake.org/t/what-cmake-generation-parameter-determines-cmake-cxx-standard-libraries/5724
**Category:** Usage
**Created:** [May 24, 2022, 4:18pm UTC](https://discourse.cmake.org/t/what-cmake-generation-parameter-determines-cmake-cxx-standard-libraries/5724 "2022-05-24T16:18:52Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Rich\_von\_Lehe](https://discourse.cmake.org/user_avatar/discourse.cmake.org/rich_von_lehe/32/307_2.png) [@Rich\_von\_Lehe](https://discourse.cmake.org/u/Rich_von_Lehe)
#### Post date: [May 24, 2022, 4:18pm UTC](https://discourse.cmake.org/t/what-cmake-generation-parameter-determines-cmake-cxx-standard-libraries/5724/1 "2022-05-24T16:18:52Z")

</div>

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:

```auto
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.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [May 24, 2022, 11:11pm UTC](https://discourse.cmake.org/t/what-cmake-generation-parameter-determines-cmake-cxx-standard-libraries/5724/2 "2022-05-24T23:11:57Z")

</div>

> [@Rich\_von\_Lehe](#):
>
> 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’d try stripping out the flags in the file one by one.
