stuff for cross-building exes

This commit is contained in:
lif 2024-03-04 03:49:17 -08:00
parent a4c1f12d17
commit 66978351c2
2 changed files with 25 additions and 1 deletions

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.9)
project(cgbwebcam)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
@ -43,3 +43,10 @@ include_directories(mgba/include)
add_executable(cgbwebcam main.c)
target_link_libraries(cgbwebcam SDL3-static mgba)
include(CheckIPOSupported)
check_ipo_supported(RESULT lto)
if(lto)
set_property(TARGET cgbwebcam PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()

17
mingw.cmake Normal file
View File

@ -0,0 +1,17 @@
# the name of the target operating system
set(CMAKE_SYSTEM_NAME Windows)
# which compilers to use for C and C++
set(CMAKE_C_COMPILER i686-w64-mingw32-gcc)
set(CMAKE_CXX_COMPILER i686-w64-mingw32-g++)
# where is the target environment located
set(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32)
# adjust the default behavior of the FIND_XXX() commands:
# search programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# search headers and libraries in the target environment
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)