eco2d/cmake/utils.cmake

26 lines
846 B
CMake
Raw Normal View History

2021-01-19 09:44:43 +00:00
function(link_system_libs target_name)
if (WIN32)
target_link_libraries(${target_name} winmm)
elseif (APPLE)
target_link_libraries(${target_name} pthread m dl)
2022-09-11 17:42:06 +00:00
elseif (EMSCRIPTEN)
target_link_libraries(${target_name} pthread m dl)
2021-01-19 09:44:43 +00:00
elseif (UNIX)
target_link_libraries(${target_name} pthread m dl atomic)
endif()
2022-09-29 11:04:25 +00:00
if (NOT WIN32)
target_compile_options(${target_name} PRIVATE -Werror -Wall -Wextra -Wno-unused-function -Wno-unknown-pragmas -Wno-unused-variable -Wno-unused-parameter)
endif ()
2021-01-19 09:44:43 +00:00
endfunction()
2021-05-05 09:25:05 +00:00
2021-05-10 06:28:56 +00:00
macro(use_cxx11)
if (CMAKE_VERSION VERSION_LESS "3.1")
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
endif ()
else ()
set(CMAKE_CXX_STANDARD 11)
endif ()
endmacro(use_cxx11)