Merge branch 'cmake-outofsource'

This commit is contained in:
Kfir Itzhak 2013-11-01 14:01:42 +02:00
commit 3c59961846
8 changed files with 37 additions and 32 deletions

View File

@ -12,6 +12,11 @@ cmake_minimum_required (VERSION 2.6)
project (zoneminder)
set(zoneminder_VERSION "1.26.4")
# CMake does not allow out-of-source build if CMakeCache.exists in the source folder. Abort and notify the user to save him from headache why it doesn't work.
if((NOT (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)) AND (EXISTS "${CMAKE_SOURCE_DIR}/CMakeCache.txt"))
message(FATAL_ERROR " You are attempting to do an out-of-source build, but a cmake cache file for an in-source build exists. Please delete the file CMakeCache.txt from the source folder to proceed.")
endif((NOT (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)) AND (EXISTS "${CMAKE_SOURCE_DIR}/CMakeCache.txt"))
# Default build type. To change the build type, use the CMAKE_BUILD_TYPE configuration option.
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type: Release or Debug" FORCE)

View File

@ -1,7 +1,7 @@
# CMakeLists.txt for the ZoneMinder database scripts
# Create files from the .in files
configure_file(zm_create.sql.in ${CMAKE_CURRENT_SOURCE_DIR}/zm_create.sql @ONLY)
configure_file(zm_create.sql.in "${CMAKE_CURRENT_BINARY_DIR}/zm_create.sql" @ONLY)
# Glob all files matching zm*.sql (to exclude *.in files and autotools's files)
file(GLOB dbfileslist RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "zm*.sql")

View File

@ -1,9 +1,9 @@
# CMakeLists.txt for the ZoneMinder misc files
# Create files from the .in files
configure_file(apache.conf.in ${CMAKE_CURRENT_SOURCE_DIR}/apache.conf @ONLY)
configure_file(logrotate.conf.in ${CMAKE_CURRENT_SOURCE_DIR}/logrotate.conf @ONLY)
configure_file(syslog.conf.in ${CMAKE_CURRENT_SOURCE_DIR}/syslog.conf @ONLY)
configure_file(apache.conf.in "${CMAKE_CURRENT_BINARY_DIR}/apache.conf" @ONLY)
configure_file(logrotate.conf.in "${CMAKE_CURRENT_BINARY_DIR}/logrotate.conf" @ONLY)
configure_file(syslog.conf.in "${CMAKE_CURRENT_BINARY_DIR}/syslog.conf" @ONLY)
# Install the misc files
install(FILES apache.conf logrotate.conf syslog.conf DESTINATION "${CMAKE_INSTALL_DATADIR}/zoneminder/misc")

View File

@ -1,26 +1,26 @@
# CMakeLists.txt for the ZoneMinder perl scripts.
# Process the perl modules subdirectory
add_subdirectory(ZoneMinder ZoneMinder)
add_subdirectory(ZoneMinder)
# Create files from the .in files
configure_file(zmaudit.pl.in ${CMAKE_CURRENT_SOURCE_DIR}/zmaudit.pl @ONLY)
configure_file(zmcontrol.pl.in ${CMAKE_CURRENT_SOURCE_DIR}/zmcontrol.pl @ONLY)
configure_file(zmdc.pl.in ${CMAKE_CURRENT_SOURCE_DIR}/zmdc.pl @ONLY)
configure_file(zmfilter.pl.in ${CMAKE_CURRENT_SOURCE_DIR}/zmfilter.pl @ONLY)
configure_file(zmpkg.pl.in ${CMAKE_CURRENT_SOURCE_DIR}/zmpkg.pl @ONLY)
configure_file(zmtrack.pl.in ${CMAKE_CURRENT_SOURCE_DIR}/zmtrack.pl @ONLY)
configure_file(zmtrigger.pl.in ${CMAKE_CURRENT_SOURCE_DIR}/zmtrigger.pl @ONLY)
configure_file(zmupdate.pl.in ${CMAKE_CURRENT_SOURCE_DIR}/zmupdate.pl @ONLY)
configure_file(zmvideo.pl.in ${CMAKE_CURRENT_SOURCE_DIR}/zmvideo.pl @ONLY)
configure_file(zmwatch.pl.in ${CMAKE_CURRENT_SOURCE_DIR}/zmwatch.pl @ONLY)
configure_file(zmaudit.pl.in "${CMAKE_CURRENT_BINARY_DIR}/zmaudit.pl" @ONLY)
configure_file(zmcontrol.pl.in "${CMAKE_CURRENT_BINARY_DIR}/zmcontrol.pl" @ONLY)
configure_file(zmdc.pl.in "${CMAKE_CURRENT_BINARY_DIR}/zmdc.pl" @ONLY)
configure_file(zmfilter.pl.in "${CMAKE_CURRENT_BINARY_DIR}/zmfilter.pl" @ONLY)
configure_file(zmpkg.pl.in "${CMAKE_CURRENT_BINARY_DIR}/zmpkg.pl" @ONLY)
configure_file(zmtrack.pl.in "${CMAKE_CURRENT_BINARY_DIR}/zmtrack.pl" @ONLY)
configure_file(zmtrigger.pl.in "${CMAKE_CURRENT_BINARY_DIR}/zmtrigger.pl" @ONLY)
configure_file(zmupdate.pl.in "${CMAKE_CURRENT_BINARY_DIR}/zmupdate.pl" @ONLY)
configure_file(zmvideo.pl.in "${CMAKE_CURRENT_BINARY_DIR}/zmvideo.pl" @ONLY)
configure_file(zmwatch.pl.in "${CMAKE_CURRENT_BINARY_DIR}/zmwatch.pl" @ONLY)
if(NOT ZM_NO_X10)
configure_file(zmx10.pl.in ${CMAKE_CURRENT_SOURCE_DIR}/zmx10.pl @ONLY)
configure_file(zmx10.pl.in "${CMAKE_CURRENT_BINARY_DIR}/zmx10.pl" @ONLY)
endif(NOT ZM_NO_X10)
#configure_file(zmdbbackup.in ${CMAKE_CURRENT_SOURCE_DIR}/zmdbbackup @ONLY)
#configure_file(zmdbrestore.in ${CMAKE_CURRENT_SOURCE_DIR}/zmdbrestore @ONLY)
configure_file(zm.in ${CMAKE_CURRENT_SOURCE_DIR}/zm @ONLY)
#configure_file(zmeventdump.in ${CMAKE_CURRENT_SOURCE_DIR}/zmeventdump @ONLY)
#configure_file(zmdbbackup.in zmdbbackup @ONLY)
#configure_file(zmdbrestore.in zmdbrestore @ONLY)
configure_file(zm.in "${CMAKE_CURRENT_BINARY_DIR}/zm" @ONLY)
#configure_file(zmeventdump.in zmeventdump @ONLY)
# Install the perl scripts
install(FILES zmaudit.pl zmcontrol.pl zmdc.pl zmfilter.pl zmpkg.pl zmtrack.pl zmtrigger.pl zmupdate.pl zmvideo.pl zmwatch.pl DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}" PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

View File

@ -1,10 +1,10 @@
# CMakeLists.txt for the ZoneMinder perl module.
# Create files from the .in files
configure_file(lib/ZoneMinder/Base.pm.in ${CMAKE_CURRENT_SOURCE_DIR}/lib/ZoneMinder/Base.pm @ONLY)
configure_file(lib/ZoneMinder/Config.pm.in ${CMAKE_CURRENT_SOURCE_DIR}/lib/ZoneMinder/Config.pm @ONLY)
configure_file(lib/ZoneMinder/Memory.pm.in ${CMAKE_CURRENT_SOURCE_DIR}/lib/ZoneMinder/Memory.pm @ONLY)
configure_file(lib/ZoneMinder/ConfigData.pm.in ${CMAKE_CURRENT_SOURCE_DIR}/lib/ZoneMinder/ConfigData.pm @ONLY)
configure_file(lib/ZoneMinder/Base.pm.in "${CMAKE_CURRENT_BINARY_DIR}/lib/ZoneMinder/Base.pm" @ONLY)
configure_file(lib/ZoneMinder/Config.pm.in "${CMAKE_CURRENT_BINARY_DIR}/lib/ZoneMinder/Config.pm" @ONLY)
configure_file(lib/ZoneMinder/Memory.pm.in "${CMAKE_CURRENT_BINARY_DIR}/lib/ZoneMinder/Memory.pm" @ONLY)
configure_file(lib/ZoneMinder/ConfigData.pm.in "${CMAKE_CURRENT_BINARY_DIR}/lib/ZoneMinder/ConfigData.pm" @ONLY)
if(CMAKE_VERBOSE_MAKEFILE)
set(MAKEMAKER_NOECHO_COMMAND "")
@ -13,10 +13,10 @@ else(CMAKE_VERBOSE_MAKEFILE)
endif(CMAKE_VERBOSE_MAKEFILE)
# Add build target for the perl modules
add_custom_target(zmperlmodules ALL perl Makefile.PL FIRST_MAKEFILE=MakefilePerl PREFIX=output LIB="output/${ZM_PERL_SUBPREFIX}" INSTALLSITEMAN3DIR="output/${CMAKE_INSTALL_MANDIR}/man3" ${MAKEMAKER_NOECHO_COMMAND} COMMAND make --makefile=MakefilePerl COMMAND make --makefile=MakefilePerl pure_install COMMENT "Building ZoneMinder perl modules")
add_custom_target(zmperlmodules ALL perl Makefile.PL FIRST_MAKEFILE=MakefilePerl PREFIX="${CMAKE_CURRENT_BINARY_DIR}/output" LIB="${CMAKE_CURRENT_BINARY_DIR}/output/${ZM_PERL_SUBPREFIX}" INSTALLSITEMAN3DIR="${CMAKE_CURRENT_BINARY_DIR}/output/${CMAKE_INSTALL_MANDIR}/man3" ${MAKEMAKER_NOECHO_COMMAND} COMMAND make --makefile=MakefilePerl COMMAND make --makefile=MakefilePerl pure_install WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" COMMENT "Building ZoneMinder perl modules")
# Add install target for the perl modules
install(DIRECTORY output/ DESTINATION "${CMAKE_INSTALL_PREFIX}")
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/output/" DESTINATION "${CMAKE_INSTALL_PREFIX}")
# Add additional commands to make clean
# Add additional files and directories to make clean
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "output;blib;pm_to_blib;MakefilePerl")

View File

@ -1,7 +1,7 @@
# CMakeLists.txt for the ZoneMinder binaries
# Create files from the .in files
configure_file(zm_config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/zm_config.h @ONLY)
configure_file(zm_config.h.in "${CMAKE_CURRENT_BINARY_DIR}/zm_config.h" @ONLY)
# Group together all the source files that are used by all the binaries (zmc, zma, zmu, zms etc)
set(ZM_BIN_SRC_FILES zm_box.cpp zm_buffer.cpp zm_camera.cpp zm_comms.cpp zm_config.cpp zm_coord.cpp zm.cpp zm_db.cpp zm_logger.cpp zm_event.cpp zm_exception.cpp zm_file_camera.cpp zm_ffmpeg_camera.cpp zm_image.cpp zm_jpeg.cpp zm_local_camera.cpp zm_monitor.cpp zm_ffmpeg.cpp zm_mpeg.cpp zm_poly.cpp zm_regexp.cpp zm_remote_camera.cpp zm_remote_camera_http.cpp zm_remote_camera_rtsp.cpp zm_rtp.cpp zm_rtp_ctrl.cpp zm_rtp_data.cpp zm_rtp_source.cpp zm_rtsp.cpp zm_sdp.cpp zm_signal.cpp zm_stream.cpp zm_thread.cpp zm_time.cpp zm_timer.cpp zm_user.cpp zm_utils.cpp zm_zone.cpp)

View File

@ -1,10 +1,10 @@
# CMakeLists.txt for the ZoneMinder web files
# Process the tools/mootools subdirectory
add_subdirectory(tools/mootools tools/mootools)
add_subdirectory(tools/mootools)
# Create files from the .in files
configure_file(includes/config.php.in ${CMAKE_CURRENT_SOURCE_DIR}/includes/config.php @ONLY)
configure_file(includes/config.php.in "${CMAKE_CURRENT_BINARY_DIR}/includes/config.php" @ONLY)
# Install the web files
install(DIRECTORY ajax css graphics includes js lang skins tools views DESTINATION "${ZM_WEBDIR}" PATTERN "*.in" EXCLUDE PATTERN "*Make*" EXCLUDE)

View File

@ -11,7 +11,7 @@ else(NOT mtcorelist)
math(EXPR mtcoreindex "${mtcorelistcount} - 1")
list(GET mtcorelist ${mtcoreindex} mtcorelatest)
message(STATUS "Using mootools core file: ${mtcorelatest}")
execute_process(COMMAND ln -f -s "${mtcorelatest}" "${CMAKE_CURRENT_SOURCE_DIR}/mootools-core.js" RESULT_VARIABLE mtcoreresult)
execute_process(COMMAND ln -f -s "${mtcorelatest}" "${CMAKE_CURRENT_BINARY_DIR}/mootools-core.js" RESULT_VARIABLE mtcoreresult)
if(mtcoreresult)
message(WARNING " Failed creating the required symlinks for mootools-core. Exit code: ${mtcoreresult}")
endif(mtcoreresult)
@ -27,7 +27,7 @@ else(NOT mtmorelist)
math(EXPR mtmoreindex "${mtmorelistcount} - 1")
list(GET mtmorelist ${mtmoreindex} mtmorelatest)
message(STATUS "Using mootools more file: ${mtmorelatest}")
execute_process(COMMAND ln -f -s "${mtmorelatest}" "${CMAKE_CURRENT_SOURCE_DIR}/mootools-more.js" RESULT_VARIABLE mtmoreresult)
execute_process(COMMAND ln -f -s "${mtmorelatest}" "${CMAKE_CURRENT_BINARY_DIR}/mootools-more.js" RESULT_VARIABLE mtmoreresult)
if(mtmoreresult)
message(WARNING " Failed creating the required symlinks for mootools-more. Exit code: ${mtmoreresult}")
endif(mtmoreresult)