-set(CUSTOMFILES
- settings/settings.php
- settings/phrase_settings.php
- website/deletable.php
- website/details.php
- website/hierarchy.php
- website/lookup.php
- website/polygons.php
- website/reverse.php
- website/search.php
- website/status.php
- utils/blocks.php
- utils/country_languages.php
- utils/imports.php
- utils/importWikipedia.php
- utils/query.php
- utils/server_compare.php
- utils/setup.php
- utils/specialphrases.php
- utils/update.php
- utils/warm.php
+# Setting PHP binary variable as to command line (prevailing) or auto detect
+
+if (BUILD_API OR BUILD_IMPORTER)
+ if (NOT PHP_BIN)
+ find_program (PHP_BIN php)
+ endif()
+ # sanity check if PHP binary exists
+ if (NOT EXISTS ${PHP_BIN})
+ message(FATAL_ERROR "PHP binary not found. Install php or provide location with -DPHP_BIN=/path/php ")
+ endif()
+ message (STATUS "Using PHP binary " ${PHP_BIN})
+endif()
+
+#-----------------------------------------------------------------------------
+# import scripts and utilities (importer only)
+#-----------------------------------------------------------------------------
+
+if (BUILD_IMPORTER)
+ set(CUSTOMSCRIPTS
+ check_import_finished.php
+ country_languages.php
+ importWikipedia.php
+ export.php
+ query.php
+ setup.php
+ specialphrases.php
+ update.php
+ warm.php
+ )
+
+ foreach (script_source ${CUSTOMSCRIPTS})
+ configure_file(${PROJECT_SOURCE_DIR}/cmake/script.tmpl
+ ${PROJECT_BINARY_DIR}/utils/${script_source})
+ endforeach()
+endif()
+
+#-----------------------------------------------------------------------------
+# webserver scripts (API only)
+#-----------------------------------------------------------------------------
+
+if (BUILD_API)
+ set(WEBSITESCRIPTS
+ deletable.php
+ details.php
+ lookup.php
+ polygons.php
+ reverse.php
+ search.php
+ status.php