186a661d1e
Credit goes to @myfreeer https://github.com/myfreeer/chrome-pak-customizer
26 lines
1.2 KiB
CMake
26 lines
1.2 KiB
CMake
cmake_minimum_required(VERSION 2.8)
|
|
project(chrome-pak C)
|
|
option(LGPL "Use custom startfiles on windows for smaller binary, requiring GNU Lesser General Public License 2.1+." ON)
|
|
if (NOT CMAKE_BUILD_TYPE)
|
|
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release." FORCE)
|
|
endif (NOT CMAKE_BUILD_TYPE)
|
|
if (MSVC)
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MT /wd4996 /wd4068")
|
|
set(CompilerFlags
|
|
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
|
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE)
|
|
foreach (CompilerFlag ${CompilerFlags})
|
|
string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
|
|
endforeach ()
|
|
endif ()
|
|
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
|
|
set(CMAKE_C_FLAGS "-O3 -Os -pipe -Wall -Wextra -fmerge-all-constants -Wl,--gc-sections,--build-id=none")
|
|
set(CMAKE_C_FLAGS_DEBUG "-g")
|
|
set(CMAKE_C_FLAGS_RELEASE "-s")
|
|
if (WIN32 AND LGPL)
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -nostartfiles -D_LGPL")
|
|
endif ()
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_C_FLAGS}")
|
|
endif ()
|
|
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} DIR_SRCS)
|
|
add_executable(pak ${DIR_SRCS})
|