Skip to content

Commit

Permalink
Added SFML_GENERATE_PDB CMake option; check CMake version dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
Bromeon authored and eXpl0it3r committed Mar 1, 2016
1 parent 2bd897c commit 77609e1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
22 changes: 17 additions & 5 deletions CMakeLists.txt
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 2.8.3)

# define a macro that helps defining an option
macro(sfml_set_option var default type docstring)
Expand Down Expand Up @@ -127,6 +127,16 @@ endif()

# Visual C++: remove warnings regarding SL security and algorithms on pointers
if(SFML_COMPILER_MSVC)
# add an option to choose whether PDB debug symbols should be generated (defaults to true when possible)
if(CMAKE_VERSION VERSION_LESS 3.1)
sfml_set_option(SFML_GENERATE_PDB FALSE BOOL "True to generate PDB debug symbols, FALSE otherwise. Requires CMake 3.1.")
if(SFML_GENERATE_PDB)
message(FATAL_ERROR "Generation of PDB files (SFML_GENERATE_PDB) requires at least CMake 3.1.0")
endif()
else()
sfml_set_option(SFML_GENERATE_PDB TRUE BOOL "True to generate PDB debug symbols, FALSE otherwise. Requires CMake 3.1.")
endif()

add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
endif()

Expand Down Expand Up @@ -232,10 +242,12 @@ if(NOT SFML_BUILD_FRAMEWORKS)
COMPONENT devel
FILES_MATCHING PATTERN "*.hpp" PATTERN "*.inl")

install(DIRECTORY ${PROJECT_BINARY_DIR}/lib
DESTINATION .
COMPONENT devel
FILES_MATCHING PATTERN "*.pdb")
if(SFML_GENERATE_PDB)
install(DIRECTORY ${PROJECT_BINARY_DIR}/lib
DESTINATION .
COMPONENT devel
FILES_MATCHING PATTERN "*.pdb")
endif()
else()
# find only "root" headers
file(GLOB SFML_HEADERS RELATIVE ${PROJECT_SOURCE_DIR} "include/SFML/*")
Expand Down
2 changes: 1 addition & 1 deletion cmake/Macros.cmake
Expand Up @@ -60,7 +60,7 @@ macro(sfml_add_library target)
endif()

# For Visual Studio on Windows, export debug symbols (PDB files) to lib directory
if(SFML_OS_WINDOWS AND SFML_COMPILER_MSVC)
if(SFML_GENERATE_PDB)
# PDB files are only generated in Debug and RelWithDebInfo configurations, find out which one
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
set(SFML_PDB_POSTFIX "-d")
Expand Down

0 comments on commit 77609e1

Please sign in to comment.