cmake/nc_platform.cmake

42 lines
1.2 KiB
CMake
Raw Normal View History

###############################################################################
if (__nc_platform)
return ()
endif ()
set (__nc_platform TRUE)
###############################################################################
include ("${CMAKE_CURRENT_LIST_DIR}/compile_flag.cmake")
include ("${CMAKE_CURRENT_LIST_DIR}/link_flag.cmake")
2017-01-17 19:20:12 +11:00
###############################################################################
# attempt to detect platforms that aren't super common
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(LINUX 1)
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
set(FREEBSD 1)
elseif (WIN32)
2017-01-17 19:20:12 +11:00
else()
message (FATAL_ERROR "unknown platform")
endif()
###############################################################################
# apply useful, non-obvious, default settings for each platform
if (WINDOWS)
add_definitions("-DWIN32_LEAN_AND_MEAN")
endif(WINDOWS)
if (FREEBSD)
append_compile_flag("-I/usr/local/include")
append_link_flag("-L/usr/local/lib")
endif (FREEBSD)
###############################################################################
# general platform assistance settings
append_link_flag("-fno-common")
append_link_flag("-fno-nonansi-builtins")