Skip to content

Commit

Permalink
Apply cmake-init 689c8a9a22a77848c15209fc155afc368e3b9b59
Browse files Browse the repository at this point in the history
  • Loading branch information
scheibel committed May 9, 2017
1 parent 97666aa commit 0a0044c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 22 deletions.
25 changes: 16 additions & 9 deletions CMakeLists.txt
Expand Up @@ -6,8 +6,20 @@
# CMake version
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)

# Include cmake modules
#
# Configure CMake environment
#

# Register general cmake commands
include(cmake/Custom.cmake)

# Set policies
set_policy(CMP0028 NEW) # ENABLE CMP0028: Double colon in target name means ALIAS or IMPORTED target.
set_policy(CMP0054 NEW) # ENABLE CMP0054: Only interpret if() arguments as variables or keywords when unquoted.
set_policy(CMP0042 NEW) # ENABLE CMP0042: MACOSX_RPATH is enabled by default.
set_policy(CMP0063 NEW) # ENABLE CMP0063: Honor visibility properties for all target types.

# Include cmake modules
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

include(GenerateExportHeader)
Expand All @@ -19,15 +31,10 @@ if (${CMAKE_VERSION} VERSION_GREATER "3.2")
include(WriteCompilerDetectionHeader OPTIONAL RESULT_VARIABLE WriterCompilerDetectionHeaderFound)
endif()

# Include custom cmake modules
include(cmake/GetGitRevisionDescription.cmake)
include(cmake/Custom.cmake)
include(cmake/HealthCheck.cmake)

# Set policies
set_policy(CMP0028 NEW) # ENABLE CMP0028: Double colon in target name means ALIAS or IMPORTED target.
set_policy(CMP0054 NEW) # ENABLE CMP0054: Only interpret if() arguments as variables or keywords when unquoted.
set_policy(CMP0042 NEW) # ENABLE CMP0042: MACOSX_RPATH is enabled by default.
set_policy(CMP0063 NEW) # ENABLE CMP0063: Honor visibility properties for all target types.
include(cmake/GenerateTemplateExportHeader.cmake)


#
Expand All @@ -53,7 +60,7 @@ set(META_VERSION_PATCH "0")
set(META_VERSION_REVISION "${GIT_REV}")
set(META_VERSION "${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH}")
set(META_NAME_VERSION "${META_PROJECT_NAME} v${META_VERSION} (${META_VERSION_REVISION})")
set(META_CMAKE_INIT_SHA "8f9950e7c13cf10521cb5d4c4d8be0d6bf8fcd0c")
set(META_CMAKE_INIT_SHA "689c8a9a22a77848c15209fc155afc368e3b9b59")

string(MAKE_C_IDENTIFIER ${META_PROJECT_NAME} META_PROJECT_ID)
string(TOUPPER ${META_PROJECT_ID} META_PROJECT_ID)
Expand Down
13 changes: 0 additions & 13 deletions cmake/Custom.cmake
Expand Up @@ -44,16 +44,3 @@ function(list_extract OUTPUT REGEX)
set(${OUTPUT} ${${OUTPUT}} PARENT_SCOPE)

endfunction(list_extract)


# Creates an export header similar to generate_export_header, but for templates.
# The main difference is that for MSVC, templates must not get exported.
# When the file ${export_file} is included in source code, the macro ${target_id}_TEMPLATE_API
# may get used to define public visibility for templates on GCC and Clang platforms.
function(generate_template_export_header target target_id export_file)
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
configure_file(${PROJECT_SOURCE_DIR}/source/codegeneration/template_msvc_api.h.in ${CMAKE_CURRENT_BINARY_DIR}/${export_file})
else()
configure_file(${PROJECT_SOURCE_DIR}/source/codegeneration/template_api.h.in ${CMAKE_CURRENT_BINARY_DIR}/${export_file})
endif()
endfunction()
12 changes: 12 additions & 0 deletions cmake/GenerateTemplateExportHeader.cmake
@@ -0,0 +1,12 @@

# Creates an export header similar to generate_export_header, but for templates.
# The main difference is that for MSVC, templates must not get exported.
# When the file ${export_file} is included in source code, the macro ${target_id}_TEMPLATE_API
# may get used to define public visibility for templates on GCC and Clang platforms.
function(generate_template_export_header target target_id export_file)
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
configure_file(${PROJECT_SOURCE_DIR}/source/codegeneration/template_msvc_api.h.in ${CMAKE_CURRENT_BINARY_DIR}/${export_file})
else()
configure_file(${PROJECT_SOURCE_DIR}/source/codegeneration/template_api.h.in ${CMAKE_CURRENT_BINARY_DIR}/${export_file})
endif()
endfunction()

0 comments on commit 0a0044c

Please sign in to comment.