Skip to content

Commit 5abdf4c

Browse files
committed
Fix installed target definition.
Using CMAKE_INSTALL_INCLUDEDIR before including GNUINstallDirs results in a broken installation when CMAKE_INSTALL_PREFIX is a non-standard directory. Inspired from google/crc32c#39 PiperOrigin-RevId: 278427974
1 parent cf4d9ab commit 5abdf4c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

CMakeLists.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ if(BUILD_SHARED_LIBS)
106106
add_compile_options(-fvisibility=hidden)
107107
endif(BUILD_SHARED_LIBS)
108108

109+
# Must be included before CMAKE_INSTALL_INCLUDEDIR is used.
110+
include(GNUInstallDirs)
111+
109112
add_library(leveldb "")
110113
target_sources(leveldb
111114
PRIVATE
@@ -417,7 +420,6 @@ int main() {
417420
endif(LEVELDB_BUILD_BENCHMARKS)
418421

419422
if(LEVELDB_INSTALL)
420-
include(GNUInstallDirs)
421423
install(TARGETS leveldb
422424
EXPORT leveldbTargets
423425
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}

0 commit comments

Comments
 (0)