squirrel/CMakeLists.txt

70 lines
1.8 KiB
CMake
Raw Normal View History

2016-03-06 19:43:57 +01:00
if(MSVC)
cmake_minimum_required(VERSION 3.4)
else()
cmake_minimum_required(VERSION 2.8)
endif()
set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}" CACHE PATH "")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "")
project(squirrel C CXX)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
2016-01-29 18:56:44 +01:00
2016-03-06 19:43:57 +01:00
if(CMAKE_COMPILER_IS_GNUCXX)
2016-03-09 18:16:55 +01:00
set(SQ_FLAGS -fno-exceptions -fno-strict-aliasing -Wall -Wextra -pedantic -Wcast-qual)
2016-01-29 18:56:44 +01:00
2016-03-06 19:43:57 +01:00
if(CMAKE_BUILD_TYPE STREQUAL "Release")
set(SQ_FLAGS ${SQ_FLAGS} -O3)
2016-03-13 15:08:25 +01:00
elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
set(SQ_FLAGS ${SQ_FLAGS} -O3 -g)
elseif(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
set(SQ_FLAGS ${SQ_FLAGS} -Os)
elseif(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(SQ_FLAGS ${SQ_FLAGS} -pg -pie -gstabs -g3 -Og)
2016-03-06 19:43:57 +01:00
endif()
if(CMAKE_VERSION VERSION_GREATER 3)
add_compile_options(${SQ_FLAGS})
else()
add_definitions(${SQ_FLAGS})
endif()
2016-03-08 13:59:33 +01:00
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -std=c++0x")
2016-03-06 19:43:57 +01:00
elseif(MSVC)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
2016-01-29 18:56:44 +01:00
endif()
2016-03-06 19:43:57 +01:00
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
add_definitions(-D_SQ64)
2016-01-29 18:56:44 +01:00
endif()
2016-03-13 14:36:10 +01:00
if(NOT DEFINED INSTALL_BIN_DIR)
set(INSTALL_BIN_DIR bin)
endif()
if(NOT DEFINED INSTALL_LIB_DIR)
set(INSTALL_LIB_DIR lib)
endif()
2016-01-29 18:56:44 +01:00
add_subdirectory(squirrel)
add_subdirectory(sqstdlib)
add_subdirectory(sq)
2016-03-06 19:43:57 +01:00
2016-03-16 00:01:16 +01:00
if(NOT WIN32)
set_target_properties(squirrel sqstdlib PROPERTIES SOVERSION 0 VERSION 0.0.0)
endif()
2016-03-13 14:36:10 +01:00
if(DEFINED INSTALL_INC_DIR)
set(SQ_PUB_HEADERS include/sqconfig.h
include/sqstdaux.h
include/sqstdblob.h
include/sqstdio.h
include/sqstdmath.h
include/sqstdstring.h
include/sqstdsystem.h
include/squirrel.h)
install(FILES ${SQ_PUB_HEADERS} DESTINATION ${INSTALL_INC_DIR})
endif()