Skip to content

Commit

Permalink
Add retrocompatibility for CMake versions between 2.8.0 and 2.8.12.
Browse files Browse the repository at this point in the history
  • Loading branch information
Algiane committed Oct 24, 2017
1 parent c1d16a6 commit e46176a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ MARK_AS_ADVANCED ( CI_DIR )
###############################################################################
SET (CMAKE_RELEASE_VERSION_MAJOR "5" )
SET (CMAKE_RELEASE_VERSION_MINOR "3" )
SET (CMAKE_RELEASE_VERSION_PATCH "1" )
SET (CMAKE_RELEASE_VERSION_PATCH "2" )
SET (CMAKE_RELEASE_DATE "Apr. 10, 2017" )

SET (CMAKE_RELEASE_VERSION
Expand Down
24 changes: 19 additions & 5 deletions cmake/modules/macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,13 @@ MACRO ( ADD_AND_INSTALL_LIBRARY

ADD_LIBRARY ( ${target_name} ${target_type} ${sources} )

TARGET_INCLUDE_DIRECTORIES ( ${target_name} PRIVATE
${COMMON_BINARY_DIR} ${COMMON_SOURCE_DIR} ${CMAKE_BINARY_DIR}/include )
IF ( CMAKE_VERSION VERSION_LESS 2.8.12 )
INCLUDE_DIRECTORIES ( ${target_name} PRIVATE
${COMMON_BINARY_DIR} ${COMMON_SOURCE_DIR} ${CMAKE_BINARY_DIR}/include )
ELSE ( )
TARGET_INCLUDE_DIRECTORIES ( ${target_name} PRIVATE
${COMMON_BINARY_DIR} ${COMMON_SOURCE_DIR} ${CMAKE_BINARY_DIR}/include )
ENDIF ( )

SET_TARGET_PROPERTIES ( ${target_name}
PROPERTIES OUTPUT_NAME ${output_name} )
Expand Down Expand Up @@ -140,8 +145,13 @@ MACRO ( ADD_AND_INSTALL_EXECUTABLE
my_add_link_flags ( ${exec_name} "/SAFESEH:NO")
ENDIF ( )

TARGET_INCLUDE_DIRECTORIES ( ${exec_name} PUBLIC
${COMMON_BINARY_DIR} ${COMMON_SOURCE_DIR} ${CMAKE_BINARY_DIR}/include )
IF ( CMAKE_VERSION VERSION_LESS 2.8.12 )
INCLUDE_DIRECTORIES ( ${exec_name} PUBLIC
${COMMON_BINARY_DIR} ${COMMON_SOURCE_DIR} ${CMAKE_BINARY_DIR}/include )
ELSE ( )
TARGET_INCLUDE_DIRECTORIES ( ${exec_name} PUBLIC
${COMMON_BINARY_DIR} ${COMMON_SOURCE_DIR} ${CMAKE_BINARY_DIR}/include )
ENDIF ( )

TARGET_LINK_LIBRARIES ( ${exec_name} ${LIBRARIES} )

Expand Down Expand Up @@ -214,7 +224,11 @@ MACRO ( ADD_LIBRARY_TEST target_name main_path target_dependency lib_name )
ADD_EXECUTABLE ( ${target_name} ${main_path} )
ADD_DEPENDENCIES( ${target_name} ${target_dependency} )

TARGET_INCLUDE_DIRECTORIES ( ${target_name} PUBLIC ${CMAKE_BINARY_DIR}/include )
IF ( CMAKE_VERSION VERSION_LESS 2.8.12 )
INCLUDE_DIRECTORIES ( ${target_name} PUBLIC ${CMAKE_BINARY_DIR}/include )
ELSE ( )
TARGET_INCLUDE_DIRECTORIES ( ${target_name} PUBLIC ${CMAKE_BINARY_DIR}/include )
ENDIF ( )

IF ( WIN32 AND ((NOT MINGW) AND USE_SCOTCH) )
MY_ADD_LINK_FLAGS ( ${target_name} "/SAFESEH:NO" )
Expand Down

0 comments on commit e46176a

Please sign in to comment.