let cmake escape -D preproc. definitions

As cmake now warns when policies are set to OLD, change the CMP0005
policy to NEW.

What this does is have cmake escape -D preprocessor definitions passed
to e.g. add_definitions() starting in cmake 2.6 . This is fine since the
minimum cmake version we support is 2.8.12 . It also makes the code
cleaner since we don't have to escape quotes anymore ourselves. This
will also work better on different platforms, where different escapes
may be needed.

Remove all quote escapes from string params to add_definitions() for
this policy change to work.
This commit is contained in:
Rafael Kitover 2017-08-09 02:34:40 -07:00
parent 0bdbcf3188
commit 1d0eece046
1 changed files with 9 additions and 8 deletions

View File

@ -9,10 +9,11 @@ ENDIF()
SET(ALL_TARGETS fex visualboyadvance-m vbamcore vbam)
if( COMMAND cmake_policy )
cmake_policy( SET CMP0003 NEW )
cmake_policy( SET CMP0005 OLD )
endif( COMMAND cmake_policy )
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW) # link to full path of libs
cmake_policy(SET CMP0005 NEW) # escapes in add_definitions
endif(COMMAND cmake_policy)
SET( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeScripts )
#Output all binaries at top level
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
@ -113,7 +114,7 @@ IF( NOT VERSION )
if(GIT_FOUND)
include(GetGitRevisionDescription)
get_git_head_revision(REFSPEC COMMITHASH)
SET( VERSION "GIT Commit: " ${COMMITHASH} )
SET(VERSION "GIT Commit: ${COMMITHASH}")
else(GIT_FOUND)
message(WARNING "Git executable not found")
endif(GIT_FOUND)
@ -210,8 +211,8 @@ ENDIF( ENABLE_LIRC )
INCLUDE(GNUInstallDirs)
# C defines
ADD_DEFINITIONS (-DHAVE_NETINET_IN_H -DHAVE_ARPA_INET_H -DHAVE_ZLIB_H -DFINAL_VERSION -DSDL -DUSE_OPENGL -DSYSCONF_INSTALL_DIR=\\\""${CMAKE_INSTALL_FULL_SYSCONFDIR}"\\\" -DWITH_LIRC=${WITHLIRC})
ADD_DEFINITIONS (-DVERSION=\\\""${VERSION}"\\\" -DPKGDATADIR=\\\""${CMAKE_INSTALL_FULL_DATADIR}/vbam"\\\" -DPACKAGE=)
ADD_DEFINITIONS (-DHAVE_NETINET_IN_H -DHAVE_ARPA_INET_H -DHAVE_ZLIB_H -DFINAL_VERSION -DSDL -DUSE_OPENGL -DSYSCONF_INSTALL_DIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}" -DWITH_LIRC=${WITHLIRC})
ADD_DEFINITIONS (-DVERSION="${VERSION}" -DPKGDATADIR="${CMAKE_INSTALL_FULL_DATADIR}/vbam" -DPACKAGE=)
if( ENABLE_LINK )
# IPC linking code needs sem_timedwait which can be either in librt or pthreads
@ -252,7 +253,7 @@ ENDIF( NOT ENABLE_ASM_CORE )
if( ENABLE_NLS )
SET( LOCALEDIR ${CMAKE_INSTALL_PREFIX}/share/locale )
ADD_DEFINITIONS ( -DENABLE_NLS )
ADD_DEFINITIONS ( -DLOCALEDIR=\\\""${LOCALEDIR}"\\\" )
ADD_DEFINITIONS ( -DLOCALEDIR="${LOCALEDIR}" )
# for now, only GBALink.cpp uses gettext() directly
IF(APPLE)
# use Homebrew gettext if available