2013-12-02 05:25:24 +05:30
|
|
|
project(updater)
|
|
|
|
|
|
|
|
cmake_minimum_required(VERSION 2.6)
|
|
|
|
enable_testing()
|
|
|
|
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
|
|
|
|
|
|
|
|
include_directories(depends)
|
|
|
|
|
2014-04-06 23:13:09 +05:30
|
|
|
if(WIN32)
|
|
|
|
include_directories(depends/win32cpp)
|
2013-12-02 05:25:24 +05:30
|
|
|
|
2013-12-17 05:07:56 +05:30
|
|
|
# static all the things. The updater must have no dependencies, or it will fail.
|
2014-04-06 23:13:09 +05:30
|
|
|
if(MINGW)
|
2013-12-17 05:07:56 +05:30
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libgcc -static")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++ -static")
|
|
|
|
#set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS} -static-libgcc -s")
|
|
|
|
#set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS} -static-libgcc -static-libstdc++ -s")
|
|
|
|
endif()
|
|
|
|
|
2014-04-06 23:13:09 +05:30
|
|
|
if(MSVC)
|
2013-12-02 05:25:24 +05:30
|
|
|
# - Link the updater binary statically with the Visual C++ runtime
|
|
|
|
# so that the executable can function standalone.
|
|
|
|
# - Enable PDB generation for release builds
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "/MT")
|
|
|
|
set(CMAKE_C_FLAGS_DEBUG "/MT")
|
|
|
|
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "/MT /Zi /O2 /Ob2 /D NDEBUG")
|
|
|
|
set(CMAKE_C_FLAGS_RELEASE "/MT /Zi /O2 /Ob2 /D NDEBUG")
|
|
|
|
remove_definitions(-DUNICODE -D_UNICODE)
|
2014-04-06 23:13:09 +05:30
|
|
|
endif()
|
2013-12-02 05:25:24 +05:30
|
|
|
else()
|
|
|
|
# optimize for reduced code size
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "-Os")
|
|
|
|
set(CMAKE_C_FLAGS_RELEASE "-Os")
|
|
|
|
endif()
|
|
|
|
|
2014-04-06 23:13:09 +05:30
|
|
|
if(APPLE)
|
2013-12-02 05:25:24 +05:30
|
|
|
# Build the updater as a dual 32/64bit binary. If only one architecture
|
|
|
|
# is required, removing the other architecture will reduce the size
|
|
|
|
# of the updater binary
|
|
|
|
set(CMAKE_OSX_ARCHITECTURES i386;x86_64)
|
|
|
|
|
2015-02-17 02:35:39 +05:30
|
|
|
# Build the updater so that it works on OS X 10.7 and above.
|
|
|
|
set(MIN_OSX_VERSION 10.7)
|
2013-12-02 05:25:24 +05:30
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=${MIN_OSX_VERSION}")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=${MIN_OSX_VERSION}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_subdirectory(src)
|
|
|
|
add_subdirectory(depends/AnyOption)
|
|
|
|
add_subdirectory(depends/tinyxml)
|
|
|
|
|