diff --git a/CMakeLists.txt b/CMakeLists.txt index 382e3e1..9f876fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/mingw.cmake b/mingw.cmake new file mode 100644 index 0000000..3af31a0 --- /dev/null +++ b/mingw.cmake @@ -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)