Skip to content

Commit 87ca000

Browse files
authored
Merge pull request #174 from jarrettchisholm/master
Fix C++11 feature checking for Microsoft Visual C++ Build Tools 2015
2 parents 5d3e2d4 + ef27fc3 commit 87ca000

File tree

3 files changed

+22
-124
lines changed

3 files changed

+22
-124
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ compiler:
55
before_install:
66
- sudo apt-add-repository -y ppa:jkeiren/ppa
77
- if test $CC = gcc; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; fi
8+
- sudo add-apt-repository -y ppa:george-edison55/precise-backports
89
- sudo apt-get update -qq
910
- if test $CC = gcc; then sudo apt-get install --yes --force-yes gcc-4.7 g++-4.7; fi
1011
- if test $CC = gcc; then sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 20; fi
1112
- if test $CC = gcc; then sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.7 20; fi
1213
- if test $CC = gcc; then sudo update-alternatives --config gcc; fi
1314
- if test $CC = gcc; then sudo update-alternatives --config g++; fi
15+
- sudo apt-get install --yes --force-yes cmake cmake-data
1416

1517
script: ./scripts/travis.sh

CMakeLists.txt

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
cmake_minimum_required(VERSION 2.8)
1+
cmake_minimum_required(VERSION 3.1)
22
set(ENTITYX_MAJOR_VERSION 1)
33
set(ENTITYX_MINOR_VERSION 1)
44
set(ENTITYX_PATCH_VERSION 2)
55
set(ENTITYX_VERSION ${ENTITYX_MAJOR_VERSION}.${ENTITYX_MINOR_VERSION}.${ENTITYX_PATCH_VERSION})
6+
set(CMAKE_CXX_EXTENSIONS OFF)
67

78
project(EntityX)
89

@@ -28,7 +29,7 @@ include(CheckCXXSourceCompiles)
2829

2930
# Default compiler args
3031
if (CMAKE_CXX_COMPILER_ID MATCHES "(GNU|.*Clang)")
31-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Werror -Wall -Wextra -Wno-unused-parameter -Wno-error=unused-variable -Wno-error=sign-compare -std=c++11")
32+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Werror -Wall -Wextra -Wno-unused-parameter -Wno-error=unused-variable -Wno-error=sign-compare")
3233
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
3334
set(CMAKE_CXX_FLAGS_MINSIZEREL "-g -Os -DNDEBUG")
3435
set(CMAKE_CXX_FLAGS_RELEASE "-g -O2 -DNDEBUG")
@@ -54,9 +55,6 @@ if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
5455
endif(NOT DEFINED CMAKE_INSTALL_LIBDIR)
5556
set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
5657

57-
# C++11 feature checks
58-
include(CheckCXX11Features.cmake)
59-
6058
set(OLD_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
6159
if ((MAKE_CXX_COMPILER_ID STREQUAL "GNU") OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
6260
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
@@ -115,16 +113,6 @@ if (NOT CMAKE_BUILD_TYPE)
115113
set(CMAKE_BUILD_TYPE "Release")
116114
endif()
117115

118-
message(STATUS "-- Checking C++ features")
119-
require(HAS_CXX11_AUTO "C++11 auto support")
120-
require(HAS_CXX11_NULLPTR "C++11 nullptr support")
121-
require(HAS_CXX11_RVALUE_REFERENCES "C++11 rvalue reference support")
122-
#require(HAS_CXX11_CSTDINT_H "C++11 stdint support")
123-
require(HAS_CXX11_VARIADIC_TEMPLATES "C++11 variadic templates")
124-
require(HAS_CXX11_RVALUE_REFERENCES "C++11 rvalue references")
125-
require(HAS_CXX11_LONG_LONG "C++11 long long")
126-
require(HAS_CXX11_LAMBDA "C++11 lambdas")
127-
128116
message(STATUS "-- Checking misc features")
129117
require(HAVE_STDINT_H "stdint.h")
130118

@@ -135,16 +123,16 @@ set(sources entityx/System.cc entityx/Event.cc entityx/Entity.cc entityx/help/Ti
135123

136124
if (ENTITYX_BUILD_SHARED)
137125
message(STATUS "-- Building shared libraries (-DENTITYX_BUILD_SHARED=0 to only build static libraries)")
138-
add_library(entityx_shared SHARED ${sources})
126+
add_library(entityx SHARED ${sources})
139127

140-
set_target_properties(entityx_shared PROPERTIES
128+
set_target_properties(entityx PROPERTIES
141129
OUTPUT_NAME entityx
142130
DEBUG_POSTFIX -d
143131
VERSION ${ENTITYX_VERSION}
144132
SOVERSION ${ENTITYX_MAJOR_VERSION}
145133
FOLDER entityx)
146-
set(install_libs entityx_shared)
147-
set_property(TARGET entityx_shared APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
134+
set(install_libs entityx)
135+
set_property(TARGET entityx APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
148136
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
149137
else()
150138
add_library(entityx STATIC ${sources})
@@ -154,6 +142,19 @@ else()
154142
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
155143
endif (ENTITYX_BUILD_SHARED)
156144

145+
# Make sure C++11 features are available
146+
target_compile_features(entityx PUBLIC cxx_auto_type)
147+
target_compile_features(entityx PUBLIC cxx_nullptr)
148+
target_compile_features(entityx PUBLIC cxx_static_assert)
149+
target_compile_features(entityx PUBLIC cxx_decltype)
150+
target_compile_features(entityx PUBLIC cxx_constexpr)
151+
target_compile_features(entityx PUBLIC cxx_sizeof_member)
152+
target_compile_features(entityx PUBLIC cxx_variadic_templates)
153+
target_compile_features(entityx PUBLIC cxx_rvalue_references)
154+
target_compile_features(entityx PUBLIC cxx_long_long_type)
155+
target_compile_features(entityx PUBLIC cxx_lambdas)
156+
target_compile_features(entityx PUBLIC cxx_func_identifier)
157+
157158
if (ENTITYX_BUILD_TESTING)
158159
enable_testing()
159160
create_test(pool_test entityx/help/Pool_test.cc ${install_libs})

CheckCXX11Features.cmake

Lines changed: 0 additions & 105 deletions
This file was deleted.

0 commit comments

Comments
 (0)