# platform_defs.cmake -- # # CMake definitions for platform specific definitions. # # Copyright (c) 2016 LIG/IIHM, University of Grenoble Alpes # # See the file "gil_LicenseTerms.txt" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # Created on Oct. 29th, 2016 (FB) Std_Header() # Execute only once if(NOT CMAKE_PLATFORM_DEFS) set(CMAKE_PLATFORM_DEFS 1) # Define the build as "Release" if it was not explicitely defined as "Debug". if(${CMAKE_BUILD_TYPE} MATCHES "Debug") set(CMAKE_BUILD_TYPE "Debug") set(DEBUG_SUFFIX "d") else(${CMAKE_BUILD_TYPE} MATCHES "Debug") set(CMAKE_BUILD_TYPE "Release") set(DEBUG_SUFFIX "") endif(${CMAKE_BUILD_TYPE} MATCHES "Debug") # Platform specific definitions execute_process(COMMAND uname -s OUTPUT_VARIABLE UNAME) if(${UNAME} MATCHES "Darwin") add_definitions(-D__MACOS__=1 -D__UNIX__=1 -std=c++11) include_directories ("/opt/local/include") link_directories ("/opt/local/lib") set(MACOS 1) set(PLATFORM "macos") set(SO_PREFIX "lib") set(SO_SUFFIX ".dylib") set(SO_LINK_SUFFIX ".dylib") set(LIB_WACOM "-framework WacomMultiTouch") elseif(${UNAME} MATCHES "Linux") add_definitions(-D__LINUX__=1 -D__UNIX__=1 -std=c++11) set(LINUX 1) set(PLATFORM "linux") set(SO_PREFIX "lib") set(SO_SUFFIX ".so") set(SO_LINK_SUFFIX ".so") else() # Disable unknown pragma (4068) add_definitions( -D__WINDOWS__=1 -D_USE_MATH_DEFINES=1 -D_CRT_SECURE_NO_WARNINGS=1 -D_WINSOCK_DEPRECATED_NO_WARNINGS=1 /wd4068) set(WINDOWS 1) set(PLATFORM "windows") set(SO_PREFIX "") set(SO_SUFFIX ".dll") set(SO_LINK_SUFFIX ".lib") endif(${UNAME} MATCHES "Darwin") message(STATUS "${MSG_INDENT} CMAKE_BUILD_TYPE >${CMAKE_BUILD_TYPE}<") message(STATUS "${MSG_INDENT} PLATFORM >${PLATFORM}<") ##### Macro definitions # Define_Project_If_Needed -- macro(Define_Project_If_Needed PROJECT_NAME) if(NOT PROJECT_NAME_DEFINED) set(PROJECT_NAME_DEFINED 1) project(${PROJECT_NAME}) endif(NOT PROJECT_NAME_DEFINED) endmacro(Define_Project_If_Needed) endif(NOT CMAKE_PLATFORM_DEFS)