C++11 and CMake 3.2 compliance changes

pull/4/head
Paul Hollinsky 2018-09-21 17:32:47 -04:00
parent 95f3af3824
commit af4f4894f5
2 changed files with 9 additions and 4 deletions

View File

@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 3.2) cmake_minimum_required(VERSION 3.2)
project(icsneonext VERSION 0.1.0) project(icsneonext VERSION 0.1.0)
set(CMAKE_CXX_STANDARD 11)
include(GNUInstallDirs) include(GNUInstallDirs)
include_directories(${CMAKE_SOURCE_DIR}) include_directories(${CMAKE_SOURCE_DIR})
@ -26,7 +28,7 @@ endif(NOT WIN32)
# winpcap # winpcap
if(WIN32) if(WIN32)
include_directories(AFTER third-party/winpcap/include) include_directories(AFTER third-party/winpcap/include)
add_compile_definitions(WPCAP HAVE_REMOTE WIN32_LEAN_AND_MEAN) add_definitions(-DWPCAP -DHAVE_REMOTE -DWIN32_LEAN_AND_MEAN)
endif(WIN32) endif(WIN32)
if(WIN32) if(WIN32)
@ -61,6 +63,9 @@ add_library(icsneoc SHARED
${SRC_FILES} ${SRC_FILES}
) )
target_compile_features(icsneocpp PRIVATE cxx_auto_type cxx_constexpr cxx_lambdas cxx_nullptr cxx_range_for cxx_rvalue_references cxx_sizeof_member cxx_strong_enums)
target_compile_features(icsneoc PRIVATE cxx_auto_type cxx_constexpr cxx_lambdas cxx_nullptr cxx_range_for cxx_rvalue_references cxx_sizeof_member cxx_strong_enums)
# libftdi # libftdi
if(NOT WIN32) if(NOT WIN32)
find_package(Threads) find_package(Threads)

View File

@ -97,7 +97,7 @@ public:
Other, Other,
Invalid Invalid
}; };
static constexpr const char* GetTypeString(Type type) { static const char* GetTypeString(Type type) {
switch(type) { switch(type) {
case Type::CAN: case Type::CAN:
return "CAN"; return "CAN";
@ -114,7 +114,7 @@ public:
return "Invalid Type"; return "Invalid Type";
} }
} }
static constexpr Type GetTypeOfNetID(NetID netid) { static Type GetTypeOfNetID(NetID netid) {
switch(netid) { switch(netid) {
case NetID::HSCAN: case NetID::HSCAN:
case NetID::MSCAN: case NetID::MSCAN:
@ -154,7 +154,7 @@ public:
return Type::Other; return Type::Other;
} }
} }
static constexpr const char* GetNetIDString(NetID netid) { static const char* GetNetIDString(NetID netid) {
switch(netid) { switch(netid) {
case NetID::Device: case NetID::Device:
return "Device"; return "Device";