-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from alextwothousand/patch-1
CMake <2.8 deprecated fix
- Loading branch information
Showing
1 changed file
with
21 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,43 @@ | ||
cmake_minimum_required(VERSION 2.6) | ||
cmake_minimum_required(VERSION 3.0) | ||
project(enet C) | ||
|
||
if(MSVC) | ||
add_definitions(-W3) | ||
else() | ||
add_definitions(-Wno-error) | ||
endif() | ||
|
||
include_directories(${PROJECT_SOURCE_DIR}/include) | ||
# defaults | ||
set(ENET_STATIC ON) | ||
set(ENET_SHARED OFF) | ||
set(ENET_TEST OFF) | ||
|
||
# configure projects | ||
if (ENET_STATIC) | ||
add_library(enet_static STATIC test/library.c) | ||
add_library(enet STATIC test/library.c) | ||
|
||
if (WIN32) | ||
target_link_libraries(enet_static winmm ws2_32) | ||
target_link_libraries(enet PUBLIC winmm ws2_32) | ||
endif() | ||
endif() | ||
|
||
if (ENET_SHARED) | ||
add_definitions(-DENET_DLL) | ||
target_compile_definitions(enet PUBLIC -DENET_DLL) | ||
add_library(enet SHARED test/library.c) | ||
|
||
if (WIN32) | ||
target_link_libraries(enet winmm ws2_32) | ||
target_link_libraries(enet PUBLIC winmm ws2_32) | ||
endif() | ||
endif() | ||
|
||
if (ENET_TEST) | ||
add_executable(enet_test test/build.c) | ||
target_include_directories(enet_test PRIVATE ${PROJECT_SOURCE_DIR}/include) | ||
|
||
if (WIN32) | ||
target_link_libraries(enet_test winmm ws2_32) | ||
target_link_libraries(enet_test PUBLIC winmm ws2_32) | ||
endif() | ||
endif() | ||
|
||
|
||
if(MSVC) | ||
target_compile_options(enet PRIVATE -W3) | ||
else() | ||
target_compile_options(enet PRIVATE -Wno-error) | ||
endif() | ||
|
||
target_include_directories(enet PUBLIC ${PROJECT_SOURCE_DIR}/include) |