Skip to content

Commit cd936b3

Browse files
committed
Apply cmake-init 0048e94130c8881fc34f940a0409adf0bc22649e
1 parent c933bf0 commit cd936b3

File tree

6 files changed

+50
-22
lines changed

6 files changed

+50
-22
lines changed

CMakeLists.txt

+6-5
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
#
55

66
# CMake version
7-
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
7+
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
88

99
# Include cmake modules
1010
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
1111
include(GenerateExportHeader)
1212
include(ExternalProject)
13-
include(WriteCompilerDetectionHeader)
1413
include(cmake/GetGitRevisionDescription.cmake)
1514
include(cmake/Custom.cmake)
1615

@@ -98,7 +97,8 @@ endif()
9897
if(UNIX AND SYSTEM_DIR_INSTALL)
9998
# Install into the system (/usr/bin or /usr/local/bin)
10099
set(INSTALL_ROOT "share/${project}") # /usr/[local]/share/<project>
101-
set(INSTALL_CMAKE "share/${project}/cmake") # /usr/[local]/share/<project>
100+
set(INSTALL_CMAKE "share/${project}/cmake") # /usr/[local]/share/<project>/cmake
101+
set(INSTALL_EXAMPLES "share/${project}") # /usr/[local]/share/<project>
102102
set(INSTALL_DATA "share/${project}") # /usr/[local]/share/<project>
103103
set(INSTALL_BIN "bin") # /usr/[local]/bin
104104
set(INSTALL_SHARED "lib") # /usr/[local]/lib
@@ -112,8 +112,9 @@ else()
112112
# Install into local directory
113113
set(INSTALL_ROOT ".") # ./
114114
set(INSTALL_CMAKE "cmake") # ./cmake
115-
set(INSTALL_DATA ".") # ./bin
116-
set(INSTALL_BIN ".") # ./bin
115+
set(INSTALL_EXAMPLES ".") # ./
116+
set(INSTALL_DATA ".") # ./
117+
set(INSTALL_BIN ".") # ./
117118
set(INSTALL_SHARED "lib") # ./lib
118119
set(INSTALL_LIB "lib") # ./lib
119120
set(INSTALL_INCLUDE "include") # ./include

cmake/CompileOptions.cmake

+10-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ endif()
1919

2020
set(DEFAULT_PROJECT_OPTIONS
2121
DEBUG_POSTFIX "d"
22-
CXX_STANDARD 11
22+
CXX_STANDARD 11 # Not available before CMake 3.1; see below for manual command line argument addition
2323
LINKER_LANGUAGE "CXX"
2424
POSITION_INDEPENDENT_CODE ON
2525
CXX_VISIBILITY_PRESET "hidden"
@@ -72,8 +72,8 @@ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
7272

7373
/wd4251 # -> disable warning: 'identifier': class 'type' needs to have dll-interface to be used by clients of class 'type2'
7474
/wd4592 # -> disable warning: 'identifier': symbol will be dynamically initialized (implementation limitation)
75-
/wd4201 # -> disable warning: nonstandard extension used: nameless struct/union (caused by GLM)
76-
/wd4127 # -> disable warning: conditional expression is constant (caused by Qt)
75+
# /wd4201 # -> disable warning: nonstandard extension used: nameless struct/union (caused by GLM)
76+
# /wd4127 # -> disable warning: conditional expression is constant (caused by Qt)
7777

7878
#$<$<CONFIG:Debug>:
7979
#/RTCc # -> value is assigned to a smaller data type and results in a data loss
@@ -85,6 +85,8 @@ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
8585
/GL # -> whole program optimization: enable link-time code generation (disables Zi)
8686
/GF # -> enable string pooling
8787
>
88+
89+
# No manual c++11 enable for MSVC as all supported MSVC versions for cmake-init have C++11 implicitly enabled (MSVC >=2013)
8890
)
8991
endif ()
9092

@@ -123,6 +125,11 @@ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCH
123125
$<$<PLATFORM_ID:Darwin>:
124126
-pthread
125127
>
128+
129+
# Required for CMake < 3.1; should be removed if minimum required CMake version is raised.
130+
$<$<VERSION_LESS:${CMAKE_VERSION},3.1>:
131+
-std=c++11
132+
>
126133
)
127134
endif ()
128135

cmake/ComponentInstall.cmake

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
# Execute cmake_install.cmake wrapper that allows to pass both DESTDIR and COMPONENT environment variable
3+
4+
execute_process(
5+
COMMAND ${CMAKE_COMMAND} -DCOMPONENT=$ENV{COMPONENT} -P cmake_install.cmake
6+
)

deploy/CMakeLists.txt

+12
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,15 @@ include(${PROJECT_SOURCE_DIR}/cmake/RuntimeDependencies.cmake)
1616
#
1717

1818
include(packages/pack-glkernel.cmake)
19+
20+
21+
#
22+
# Target 'component_install'
23+
#
24+
25+
add_custom_target(
26+
component_install
27+
COMMAND make preinstall
28+
COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/cmake/ComponentInstall.cmake
29+
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
30+
)

docs/api-docs/CMakeLists.txt

+16-4
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ set(doxyfile_in doxyfile.in)
3030
#
3131

3232
# Set project variables
33-
set(doxyfile ${CMAKE_CURRENT_BINARY_DIR}/doxyfile)
34-
set(doxyfile_html ${CMAKE_CURRENT_BINARY_DIR}/html/index.html)
33+
set(doxyfile "${CMAKE_CURRENT_BINARY_DIR}/doxyfile")
34+
set(doxyfile_directory "${CMAKE_CURRENT_BINARY_DIR}/html")
35+
set(doxyfile_html "${doxyfile_directory}/index.html")
3536

3637
# Get filename and path of doxyfile
3738
get_filename_component(name ${doxyfile_in} NAME)
@@ -47,13 +48,24 @@ configure_file(${doxyfile_in} ${doxyfile})
4748
# Invoke doxygen
4849
add_custom_command(
4950
OUTPUT ${doxyfile_html}
50-
DEPENDS ${doxyfile} ${META_PROJECT_NAME}::baselib ${META_PROJECT_NAME}::fiblib
51+
DEPENDS ${doxyfile} ${META_PROJECT_NAME}::glkernel
5152
WORKING_DIRECTORY ${path}
52-
COMMAND ${CMAKE_COMMAND} -E copy_directory ${path} ${CMAKE_CURRENT_BINARY_DIR}/html # ToDO, configure doxygen to use source as is
53+
COMMAND ${CMAKE_COMMAND} -E copy_directory ${path} ${doxyfile_directory} # ToDO, configure doxygen to use source as is
5354
COMMAND ${DOXYGEN} \"${doxyfile}\"
5455
COMMENT "Creating doxygen documentation."
5556
)
5657

5758
# Declare target
5859
add_custom_target(${target} ALL DEPENDS ${doxyfile_html})
5960
add_dependencies(docs ${target})
61+
62+
63+
#
64+
# Deployment
65+
#
66+
67+
install(
68+
DIRECTORY ${doxyfile_directory}
69+
DESTINATION ${INSTALL_DOC}
70+
COMPONENT docs
71+
)

source/glkernel/CMakeLists.txt

-10
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,6 @@ add_library(${META_PROJECT_NAME}::${target} ALIAS ${target})
7272
# Export library for downstream projects
7373
export(TARGETS ${target} NAMESPACE ${META_PROJECT_NAME}:: FILE ${PROJECT_BINARY_DIR}/cmake/${target}/${target}-export.cmake)
7474

75-
# Create feature detection header
76-
# Compilers: https://cmake.org/cmake/help/v3.1/variable/CMAKE_LANG_COMPILER_ID.html#variable:CMAKE_%3CLANG%3E_COMPILER_ID
77-
# Feature: https://cmake.org/cmake/help/v3.1/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.html
78-
write_compiler_detection_header(
79-
FILE ${feature_file}
80-
PREFIX ${target_upper}
81-
COMPILERS AppleClang Clang GNU MSVC
82-
FEATURES cxx_alignas cxx_alignof cxx_constexpr cxx_final cxx_noexcept cxx_nullptr cxx_sizeof_member cxx_thread_local
83-
)
84-
8575

8676
#
8777
# Include directories

0 commit comments

Comments
 (0)