Skip to content

Commit bd8f993

Browse files
authored
[Cpp] CMake: use variables for specifying install paths consistently (#4109)
* [Cpp] CMake: use variables for specifying install paths consistently This allows overriding them if needed when the system uses different paths than usual (e.g. Haiku, which uses "develop/headers" for includes instead of "include"). Use the standard variable ${CMAKE_INSTALL_INCLUDEDIR} as the base path for the include directory. Signed-off-by: Joachim Mairböck <[email protected]> * [Cpp] CMake: include GNUInstallDirs unconditionally to have CMAKE_INSTALL_DOCDIR available Signed-off-by: Joachim Mairböck <[email protected]> --------- Signed-off-by: Joachim Mairböck <[email protected]>
1 parent 6a15cc3 commit bd8f993

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

runtime/Cpp/CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,11 @@ if(WITH_DEMO)
138138
add_subdirectory(demo)
139139
endif(WITH_DEMO)
140140

141+
include(GNUInstallDirs)
142+
141143
# Generate CMake Package Files only if install is active
142144
if (ANTLR4_INSTALL)
143145

144-
include(GNUInstallDirs)
145146
include(CMakePackageConfigHelpers)
146147

147148
if(NOT ANTLR4_CMAKE_DIR)
@@ -202,14 +203,14 @@ endif(ANTLR4_INSTALL)
202203

203204
if(EXISTS LICENSE.txt)
204205
install(FILES LICENSE.txt
205-
DESTINATION "share/doc/libantlr4")
206+
DESTINATION ${CMAKE_INSTALL_DOCDIR})
206207
elseif(EXISTS ../../LICENSE.txt)
207208
install(FILES ../../LICENSE.txt
208-
DESTINATION "share/doc/libantlr4")
209+
DESTINATION ${CMAKE_INSTALL_DOCDIR})
209210
endif()
210211

211212
install(FILES README.md VERSION
212-
DESTINATION "share/doc/libantlr4")
213+
DESTINATION ${CMAKE_INSTALL_DOCDIR})
213214

214215
set(CPACK_PACKAGE_CONTACT "[email protected]")
215216
set(CPACK_PACKAGE_VERSION ${ANTLR_VERSION})

runtime/Cpp/runtime/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if (NOT ANTLR_BUILD_SHARED AND NOT ANTLR_BUILD_STATIC)
77
message(FATAL_ERROR "Options ANTLR_BUILD_SHARED and ANTLR_BUILD_STATIC can't both be OFF")
88
endif()
99

10-
set(libantlrcpp_INCLUDE_INSTALL_DIR "include/antlr4-runtime")
10+
set(libantlrcpp_INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}/antlr4-runtime")
1111

1212
set(libantlrcpp_INCLUDE_DIRS
1313
${PROJECT_SOURCE_DIR}/runtime/src

0 commit comments

Comments
 (0)