Skip to content

Commit 497476d

Browse files
authored
Merge pull request #1414 from lonvia/no-install-II
Disable install targets when osm2pgsql is inside a subdir
2 parents 7314fc7 + c1cb774 commit 497476d

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

CMakeLists.txt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
1010

1111
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
1212

13+
# Do not create install targets when run as a subproject.
14+
# Currently used by Nominatim which cannot yet rely on installed versions
15+
# of osm2pgsql.
16+
if (${PROJECT_NAME} STREQUAL ${CMAKE_PROJECT_NAME})
17+
set(ENABLE_INSTALL ON)
18+
else()
19+
set(ENABLE_INSTALL OFF)
20+
endif()
21+
1322
if (WIN32)
1423
set(DEFAULT_STYLE "default.style" CACHE STRING "Default style used unless one is given on the command line")
1524
else()
@@ -324,5 +333,7 @@ add_subdirectory(docs)
324333
# Install
325334
#############################################################
326335

327-
install(TARGETS osm2pgsql DESTINATION bin)
328-
install(FILES default.style empty.style DESTINATION share/osm2pgsql)
336+
if (ENABLE_INSTALL)
337+
install(TARGETS osm2pgsql DESTINATION bin)
338+
install(FILES default.style empty.style DESTINATION share/osm2pgsql)
339+
endif()

docs/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@ else()
2727
message(STATUS " Manual page can not be built")
2828
endif()
2929

30-
install(FILES osm2pgsql.1 DESTINATION share/man/man1)
31-
30+
if (ENABLE_INSTALL)
31+
install(FILES osm2pgsql.1 DESTINATION share/man/man1)
32+
endif()

0 commit comments

Comments
 (0)