include_directories(Z:/CEGUI/cegui-0.8.7/cegui/include/CEGUI)
I get 1286 errors from standard C++ libs like istream, string, algorithm etc that look all over the place. CEGUI header files seem so unconnected to the C++ libs so I can't understand why it causes them to go haywire. Any help or suggestions are greatly appreciated. Here is my entire CMakeLists.txt file. Sorry about the mess. I tried adding CEGUI the same way as SFML but I kept running into a bunch of issues:
Code: Select all
cmake_minimum_required(VERSION 3.0)
project(citystates)
# Set options
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build (Debug or Release)" FORCE)
set(SFML_STATIC_LIBS FALSE CACHE BOOL "Choose whether SFML is linked statically or shared.")
set(CITYBUILDER_STATIC_STD_LIBS FALSE CACHE BOOL "Use statically linked standard/runtime libraries? This option must match the one used for SFML.")
set(SFML_ROOT "Z:/SFML2.4.1/SFML-2.4.1/;${SFML_ROOT}")
# Make sure that the runtime library gets link statically
if(CITYBUILDER_STATIC_STD_LIBS)
if(NOT SFML_STATIC_LIBS)
message("\n-> If you check CITYBUILDER_STATIC_STD_LIBS, you also need to check SFML_STATIC_LIBRARIES.")
message("-> It would lead to multiple runtime environments which result in undefined behavior.\n")
elseif(WIN32 AND MSVC)
# Change all MSVC compiler flags to /MT
foreach(flag CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE)
if(${flag} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}")
endif()
endforeach()
elseif(CMAKE_COMPILER_IS_GNUCXX)
# Note: Doesn't work for TDM compiler, since it's compiling the runtime libs statically by default
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static")
endif()
endif()
# citybuilder uses C++11 features
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
# Add directory containing FindSFML.cmake to module path
set(CMAKE_MODULE_PATH "Z:/SFML2.4.1/SFML-2.4.1/cmake/Modules/;${CMAKE_MODULE_PATH}")
# Make sure that FindSFML.cmake searches for the static libraries
if(SFML_STATIC_LIBS)
set(SFML_STATIC_LIBRARIES TRUE)
endif()
# Find SFML
find_package(SFML COMPONENTS graphics window system)
# Output an error if SFML wasn't found
if(SFML_FOUND)
include_directories(${SFML_INCLUDE_DIR})
else()
set(SFML_ROOT "" CACHE PATH "SFML top-level directory")
message("\n-> SFML directory not found. Set SFML_ROOT to SFML's top-level path (containing \"include\" and \"lib\" directories).")
message("-> Make sure the SFML libraries with the same configuration (Release/Debug, Static/Dynamic) exist.\n")
endif()
include_directories(Z:/CEGUI/cegui-0.8.7/build/cegui/include/CEGUI)
include_directories(Z:/CEGUI/cegui-0.8.7/cegui/include/CEGUI)
# Add the source files
file(GLOB CITYBUILDER_SRC
"*.h"
"*.cpp"
)
# Tell CMake to build a executable
add_executable(citystates ${CITYBUILDER_SRC})
# Link SFML
target_link_libraries(citystates ${SFML_LIBRARIES} ${SFML_DEPENDENCIES})
# Link CEGUI
target_link_libraries(citystates optimized Z:/CityStates/CityStates/CEGUI/CEGUIOpenGLRenderer-0_d.lib )
target_link_libraries(citystates optimized Z:/CityStates/CityStates/CEGUI/CEGUIBase-0_d.lib )
target_link_libraries(citystates optimized Z:/CityStates/CityStates/CEGUI/freetype_d.lib )
target_link_libraries(citystates optimized Z:/CityStates/CityStates/CEGUI/glew_d.lib )
target_link_libraries(citystates optimized Z:/CityStates/CityStates/CEGUI/glfw_d.lib )
target_link_libraries(citystates optimized Z:/CityStates/CityStates/CEGUI/jpeg_d.lib )
target_link_libraries(citystates optimized Z:/CityStates/CityStates/CEGUI/libexpat_d.lib )
target_link_libraries(citystates optimized Z:/CityStates/CityStates/CEGUI/libpng_d.lib )
target_link_libraries(citystates optimized Z:/CityStates/CityStates/CEGUI/pcre_d.lib )
target_link_libraries(citystates optimized Z:/CityStates/CityStates/CEGUI/SILLY_d.lib )
#target_link_libraries(citystates ${CEGUI_LIBRARIES} )
# Install executable
install(TARGETS citystates
RUNTIME DESTINATION .)
# Install game assets
install(DIRECTORY media/
DESTINATION media/)
# Install config files
install(FILES city_cfg.dat city_map.dat LICENSE README.md
DESTINATION .)
Just a note that I can add include_directories(Z:/CEGUI/cegui-0.8.7/build/cegui/include/CEGUI) and everything still builds just fine.


( Maybe we should wilfully add some bugs that are not fending off people at the start, but later make them have to come to the forum to seek help, it would serve as usage metric )