From 2d4d867a915115ba38776147dcc37e5d78dbfbe9 Mon Sep 17 00:00:00 2001 From: gamagan Date: Mon, 11 Sep 2023 05:48:33 -0400 Subject: [PATCH] Allow setting the App's window class name via CMake Allow setting the App's window class name via the CMake command line: cmake . -DGLFW_WNDCLASSNAME="MyWindowClassName" --- src/CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 01f191c9..e64bd2b8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -274,7 +274,14 @@ elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR endif() if (GLFW_BUILD_WIN32) - target_compile_definitions(glfw PRIVATE UNICODE _UNICODE) + # If requested, create a C #define to set the app's window class name. + # This class name is baked in at compile time. + set(_GLFW_WCN "") + if (GLFW_WNDCLASSNAME) + set(_GLFW_WCN "_GLFW_WNDCLASSNAME=L\"${GLFW_WNDCLASSNAME}\"") + endif() + + target_compile_definitions(glfw PRIVATE UNICODE _UNICODE ${_GLFW_WCN}) endif() # HACK: When building on MinGW, WINVER and UNICODE need to be defined before