2017-01-25 18:46:41 +11:00
|
|
|
###############################################################################
|
|
|
|
if (__nc_platform)
|
|
|
|
return ()
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
set (__nc_platform TRUE)
|
|
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
2022-06-15 10:46:52 +10:00
|
|
|
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)
|
2017-01-23 14:54:22 +11:00
|
|
|
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")
|