Changeset: 66a480606a35 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=66a480606a35 Added Files: monetdb_config.h.in Removed Files: cmake/monetdb_config.h.in Modified Files: CMakeLists.txt clients/mapilib/CMakeLists.txt common/stream/CMakeLists.txt gdk/CMakeLists.txt monetdb5/tools/CMakeLists.txt testing/CMakeLists.txt tools/merovingian/daemon/CMakeLists.txt tools/merovingian/daemon/config/CMakeLists.txt tools/mserver/CMakeLists.txt Branch: cmake-fun Log Message:
Compiles from outside the source directory. diffs (229 lines): diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -510,25 +510,29 @@ set(PYTHON2 "AUTO" CACHE STRING "python2 set(PYTHON3 "AUTO" CACHE STRING "python3 is installed in DIR") message(STATUS "Checking major version of Python interpreter") find_program(PYTHON_INTERPRETER python) -exec_program("${PYTHON_INTERPRETER}" ARGS "-V" OUTPUT_VARIABLE PY_OUPUT_RES RETURN_VALUE PY_RETURN_CODE) -if(PY_RETURN_CODE EQUAL 0 AND PY_OUPUT_RES) - string(FIND "${PY_OUPUT_RES}" "Python 2" MAJOR_IS_PYTHON2) - string(FIND "${PY_OUPUT_RES}" "Python 3" MAJOR_IS_PYTHON3) - if(NOT MAJOR_IS_PYTHON2 EQUAL -1) # Python 2 has precedence - set(MAJOR_PYTHON 2) - set(HAVE_PYTHON2 YES) - set(PY2_OUPUT_RES "${PY_OUPUT_RES}") - elseif(NOT MAJOR_IS_PYTHON3 EQUAL -1) - set(MAJOR_PYTHON 3) - set(HAVE_PYTHON3 YES) - set(PY3_OUPUT_RES "${PY_OUPUT_RES}") - else() - message(FATAL_ERROR "Only python versions 2 and 3 are supported by MonetDB") +if(PYTHON_INTERPRETER) + exec_program("${PYTHON_INTERPRETER}" ARGS "-V" OUTPUT_VARIABLE PY_OUPUT_RES RETURN_VALUE PY_RETURN_CODE) + if(PY_RETURN_CODE EQUAL 0 AND PY_OUPUT_RES) + string(FIND "${PY_OUPUT_RES}" "Python 2" MAJOR_IS_PYTHON2) + string(FIND "${PY_OUPUT_RES}" "Python 3" MAJOR_IS_PYTHON3) + if(NOT MAJOR_IS_PYTHON2 EQUAL -1) # Python 2 has precedence + set(MAJOR_PYTHON 2) + set(HAVE_PYTHON2 YES) + set(PY2_OUPUT_RES "${PY_OUPUT_RES}") + elseif(NOT MAJOR_IS_PYTHON3 EQUAL -1) + set(MAJOR_PYTHON 3) + set(HAVE_PYTHON3 YES) + set(PY3_OUPUT_RES "${PY_OUPUT_RES}") + else() + message(FATAL_ERROR "Only python versions 2 and 3 are supported by MonetDB") + endif() + if(MAJOR_IS_PYTHON2 OR MAJOR_IS_PYTHON3) + set(HAVE_PYTHON YES) + message(STATUS "Major Python interpreter: ${MAJOR_PYTHON}") + endif() endif() - if(MAJOR_IS_PYTHON2 OR MAJOR_IS_PYTHON3) - set(HAVE_PYTHON YES) - message(STATUS "Major Python interpreter: ${MAJOR_PYTHON}") - endif() +else() + message(WARNING "A python interpreter was not found") endif() if(NOT ${PYTHON2} STREQUAL "NO") @@ -1984,9 +1988,9 @@ set(builtby "$ENV{USER}@${BUILD_HOST}") set(compilercall "${CMAKE_C_COMPILER}${CMAKE_C_FLAGS}") set(linkercall "${CMAKE_LINKER}${CMAKE_REQUIRED_FLAGS}") -configure_file(${CMAKE_SOURCE_DIR}/cmake/monetdb_config.h.in ${CMAKE_SOURCE_DIR}/monetdb_config.h) -install(FILES monetdb_config.h DESTINATION ${INCLUDEDIR}/monetdb) -include_directories(${CMAKE_SOURCE_DIR}) +configure_file(monetdb_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/monetdb_config.h) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/monetdb_config.h DESTINATION ${INCLUDEDIR}/monetdb) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) add_subdirectory(buildtools) add_subdirectory(common) diff --git a/clients/mapilib/CMakeLists.txt b/clients/mapilib/CMakeLists.txt --- a/clients/mapilib/CMakeLists.txt +++ b/clients/mapilib/CMakeLists.txt @@ -19,6 +19,6 @@ if(NOT WIN32) if(SOCKET_LIBRARIES) set(PKG_SOCKET_LIBS "-l${SOCKET_LIBRARIES}") #TODO fix this endif() - configure_file(monetdb-mapi.pc.in monetdb-mapi.pc @ONLY) - install(FILES monetdb-mapi.pc DESTINATION ${PKGCONFIGDIR}) + configure_file(monetdb-mapi.pc.in ${CMAKE_CURRENT_BINARY_DIR}/monetdb-mapi.pc @ONLY) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/monetdb-mapi.pc DESTINATION ${PKGCONFIGDIR}) endif() diff --git a/common/stream/CMakeLists.txt b/common/stream/CMakeLists.txt --- a/common/stream/CMakeLists.txt +++ b/common/stream/CMakeLists.txt @@ -43,6 +43,6 @@ if(NOT WIN32) if(Iconv_LIBRARY AND NOT Iconv_IS_BUILT_IN) set(PKG_LIBICONV "-l${Iconv_LIBRARY}") endif() - configure_file(monetdb-stream.pc.in monetdb-stream.pc @ONLY) - install(FILES monetdb-stream.pc DESTINATION ${PKGCONFIGDIR}) + configure_file(monetdb-stream.pc.in ${CMAKE_CURRENT_BINARY_DIR}/monetdb-stream.pc @ONLY) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/monetdb-stream.pc DESTINATION ${PKGCONFIGDIR}) endif() diff --git a/gdk/CMakeLists.txt b/gdk/CMakeLists.txt --- a/gdk/CMakeLists.txt +++ b/gdk/CMakeLists.txt @@ -67,6 +67,6 @@ if(NOT WIN32) if(CMAKE_DL_LIBS) set(PKG_DL_LIBS "-l${CMAKE_DL_LIBS}") endif() - configure_file(monetdb-gdk.pc.in monetdb-gdk.pc @ONLY) - install(FILES monetdb-gdk.pc DESTINATION ${PKGCONFIGDIR}) + configure_file(monetdb-gdk.pc.in ${CMAKE_CURRENT_BINARY_DIR}/monetdb-gdk.pc @ONLY) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/monetdb-gdk.pc DESTINATION ${PKGCONFIGDIR}) endif() diff --git a/monetdb5/tools/CMakeLists.txt b/monetdb5/tools/CMakeLists.txt --- a/monetdb5/tools/CMakeLists.txt +++ b/monetdb5/tools/CMakeLists.txt @@ -29,6 +29,6 @@ if(NOT WIN32) if(CMAKE_DL_LIBS) set(PKG_PCRE "-l${PCRE_LIBRARIES}") endif() - configure_file(monetdb5.pc.in monetdb5.pc @ONLY) - install(FILES monetdb5.pc DESTINATION ${PKGCONFIGDIR}) + configure_file(monetdb5.pc.in ${CMAKE_CURRENT_BINARY_DIR}/monetdb5.pc @ONLY) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/monetdb5.pc DESTINATION ${PKGCONFIGDIR}) endif() diff --git a/cmake/monetdb_config.h.in b/monetdb_config.h.in rename from cmake/monetdb_config.h.in rename to monetdb_config.h.in diff --git a/testing/CMakeLists.txt b/testing/CMakeLists.txt --- a/testing/CMakeLists.txt +++ b/testing/CMakeLists.txt @@ -32,8 +32,14 @@ string(REPLACE "\\" "\\\\" QXPYTHON3 "${ string(REPLACE "\\" "\\\\" QXPYTHON3_LIBDIR "${PYTHON3_LIBDIR}") find_program(SH sh) +if(NOT SH) + message(FATAL_ERROR "A shell interpreter was not found") +endif() set(BASH "${SH}") find_program(PYTHON2_INT python2) +if(NOT SH) + message(FATAL_ERROR "A shell interpreter was not found") +endif() if(CMAKE_SIZEOF_VOID_P EQUAL 4) set(BITS32_FALSE "#") @@ -61,21 +67,23 @@ foreach(loop_var IN LISTS HAVE_LIST) endif() endforeach(loop_var) -configure_file(Mtest.py.in Mtest.py @ONLY) -configure_file(monet_options.py.in monet_options.py @ONLY) -configure_file(listexports.py.in listexports.py @ONLY) +configure_file(Mtest.py.in ${CMAKE_CURRENT_BINARY_DIR}/Mtest.py @ONLY) +configure_file(monet_options.py.in ${CMAKE_CURRENT_BINARY_DIR}/monet_options.py @ONLY) +configure_file(listexports.py.in ${CMAKE_CURRENT_BINARY_DIR}/listexports.py @ONLY) -install(FILES Mtest.py PERMISSIONS ${PROGRAM_PERMISSIONS_DEFAULT} DESTINATION ${BINDIR}) -install(FILES Mfilter.py process.py monet_options.py __init__.py listexports.py exportutils.py malcheck.py +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Mtest.py PERMISSIONS ${PROGRAM_PERMISSIONS_DEFAULT} DESTINATION ${BINDIR}) +install(FILES Mfilter.py process.py ${CMAKE_CURRENT_BINARY_DIR}/monet_options.py __init__.py + ${CMAKE_CURRENT_BINARY_DIR}/listexports.py exportutils.py malcheck.py DESTINATION ${CMAKE_INSTALL_PREFIX}${PYTHON_LIBDIR}/MonetDBtesting) if(WIN32) install(FILES Mlog.bat Mtest.py.bat DESTINATION ${BINDIR}) else() - configure_file(Mlog.in Mlog @ONLY) - install(FILES Mlog PERMISSIONS ${PROGRAM_PERMISSIONS_DEFAULT} DESTINATION ${BINDIR}) + configure_file(Mlog.in ${CMAKE_CURRENT_BINARY_DIR}/Mlog @ONLY) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Mlog PERMISSIONS ${PROGRAM_PERMISSIONS_DEFAULT} DESTINATION ${BINDIR}) - add_custom_target(Mapprove COMMAND ${CMAKE_COMMAND} -E create_symlink Mtest.py Mapprove.py DEPENDS Mtest.py + add_custom_target(Mbindir ALL COMMAND ${CMAKE_COMMAND} -E make_directory ${BINDIR}) + add_custom_target(Mapprove ALL COMMAND ${CMAKE_COMMAND} -E create_symlink Mtest.py Mapprove.py WORKING_DIRECTORY ${BINDIR} COMMENT "Creating symlink to Mtest.py") - add_dependencies(Mdiff Mapprove) # Hack, this will make the custom_target "Mapprove" run every time + add_dependencies(Mdiff Mbindir Mapprove) # Hack, this will make the custom_target "Mapprove" run every time endif() diff --git a/tools/merovingian/daemon/CMakeLists.txt b/tools/merovingian/daemon/CMakeLists.txt --- a/tools/merovingian/daemon/CMakeLists.txt +++ b/tools/merovingian/daemon/CMakeLists.txt @@ -20,5 +20,5 @@ target_link_libraries(monetdbd PRIVATE m ${PTHREAD_LIBRARIES} ${CMAKE_DL_LIBS} ${PCRE_LIBRARIES} ${LIBXML2_LIBRARIES}) install(TARGETS monetdbd DESTINATION ${BINDIR}) -configure_file(monetdbd.1.in monetdbd.1 @ONLY) -install(FILES monetdbd.1 DESTINATION ${DATADIR}/man/man1) +configure_file(monetdbd.1.in ${CMAKE_CURRENT_BINARY_DIR}/monetdbd.1 @ONLY) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/monetdbd.1 DESTINATION ${DATADIR}/man/man1) diff --git a/tools/merovingian/daemon/config/CMakeLists.txt b/tools/merovingian/daemon/config/CMakeLists.txt --- a/tools/merovingian/daemon/config/CMakeLists.txt +++ b/tools/merovingian/daemon/config/CMakeLists.txt @@ -11,10 +11,10 @@ set(Erundir "${RUNDIR}") set(Ebindir "${BINDIR}") set(Elocalstatedir "${LOCALSTATEDIR}") -configure_file(.merovingian_properties.in .merovingian_properties @ONLY) -configure_file(monetdbd.service.in monetdbd.service @ONLY) -configure_file(monetdbd.in monetdbd @ONLY) +configure_file(.merovingian_properties.in ${CMAKE_CURRENT_BINARY_DIR}/.merovingian_properties @ONLY) +configure_file(monetdbd.service.in ${CMAKE_CURRENT_BINARY_DIR}/monetdbd.service @ONLY) +configure_file(monetdbd.in ${CMAKE_CURRENT_BINARY_DIR}/monetdbd @ONLY) -install(FILES .merovingian_properties DESTINATION ${LOCALSTATEDIR}/monetdb5/dbfarm) -install(FILES monetdbd.service DESTINATION ${LIBDIR}/systemd/system) -install(FILES monetdbd DESTINATION ${SYSCONFDIR}/logrotate.d) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/.merovingian_properties DESTINATION ${LOCALSTATEDIR}/monetdb5/dbfarm) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/monetdbd.service DESTINATION ${LIBDIR}/systemd/system) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/monetdbd DESTINATION ${SYSCONFDIR}/logrotate.d) diff --git a/tools/mserver/CMakeLists.txt b/tools/mserver/CMakeLists.txt --- a/tools/mserver/CMakeLists.txt +++ b/tools/mserver/CMakeLists.txt @@ -6,14 +6,14 @@ # Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V. #]] -include_directories(../../monetdb5/mal ../../gdk ../../common/stream ../../common/utils ../../common/options +include_directories(. ../../monetdb5/mal ../../gdk ../../common/stream ../../common/utils ../../common/options ../../monetdb5/modules/atoms ../../monetdb5/modules/mal ../../sql/backends/monet5 ../../sql/common ../../sql/include ../../sql/server ../../sql/storage ${OPENSSL_INCS} ${PCRE_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIRS}) -configure_file(monet_version.c.in monet_version.c @ONLY) +configure_file(monet_version.c.in ${CMAKE_CURRENT_BINARY_DIR}/monet_version.c @ONLY) -add_executable(mserver5 mserver5.c monet_version.h monet_version.c) +add_executable(mserver5 mserver5.c monet_version.h ${CMAKE_CURRENT_BINARY_DIR}/monet_version.c) target_link_libraries(mserver5 PRIVATE monetdb5 mal gdk stream mapi ${UUID_LIBRARIES} ${MATH_LIBS} ${SOCKET_LIBRARIES} ${MALLOC_LIBS} ${PTHREAD_LIBRARIES} ${PTHREAD_LIBRARIES} ${CMAKE_DL_LIBS} ${OPENSSL_LIBRARIES} ${PCRE_LIBRARIES} ${LIBXML2_LIBRARIES} ${PSAPILIB_LIBS} ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} @@ -24,8 +24,8 @@ install(FILES tomographintro.docx tomogr install(FILES monetdblogo.png DESTINATION ${DATADIR}/doc/MonetDB) set(localstatedir "${LOCALSTATEDIR}") -configure_file(mserver5.1.in mserver5.1 @ONLY) -install(FILES mserver5.1 DESTINATION ${DATADIR}/man/man1) +configure_file(mserver5.1.in ${CMAKE_CURRENT_BINARY_DIR}/mserver5.1 @ONLY) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mserver5.1 DESTINATION ${DATADIR}/man/man1) if(HAVE_TESTING) add_executable(shutdowntest shutdowntest.c) _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list