Fix adding executable icon on windows with non-msvc compiler (#1136)

This commit is contained in:
Marcin Michalski 2021-03-30 08:58:32 +02:00 committed by GitHub
parent 69e44a3722
commit 4edb1eb3ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 7 deletions

View File

@ -73,7 +73,7 @@ jobs:
uses: lukka/get-cmake@latest uses: lukka/get-cmake@latest
- name: Ubuntu - install opengl lua5.1 luajit - name: Ubuntu - install opengl lua5.1 luajit
# vcpkg has lua 5.2 # vcpkg has lua 5.3+
run: sudo apt-get install libglew-dev liblua5.1-0-dev libluajit-5.1-dev run: sudo apt-get install libglew-dev liblua5.1-0-dev libluajit-5.1-dev
if: contains( matrix.os, 'ubuntu') if: contains( matrix.os, 'ubuntu')

View File

@ -23,13 +23,24 @@ set(executable_SOURCES
src/main.cpp src/main.cpp
) )
# add executable icon for win32 platforms
if(WIN32) if(WIN32)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/otcicon.o if(MSVC)
COMMAND ${CMAKE_RC_COMPILER} add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/otcicon.o
-I${CMAKE_CURRENT_SOURCE_DIR}/src COMMAND ${CMAKE_RC_COMPILER}
-fo${CMAKE_CURRENT_BINARY_DIR}/otcicon.o -I${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/src/otcicon.rc) -fo${CMAKE_CURRENT_BINARY_DIR}/otcicon.o
${CMAKE_CURRENT_SOURCE_DIR}/src/otcicon.rc
)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
else()
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/otcicon.o
COMMAND ${CMAKE_RC_COMPILER}
-I${CMAKE_CURRENT_SOURCE_DIR}/src
-i${CMAKE_CURRENT_SOURCE_DIR}/src/otcicon.rc
-o ${CMAKE_CURRENT_BINARY_DIR}/otcicon.o
)
endif()
set(executable_SOURCES ${executable_SOURCES} otcicon.o) set(executable_SOURCES ${executable_SOURCES} otcicon.o)
endif() endif()