anope

- supernets anope source code & configuration
git clone git://git.acid.vegas/anope.git
Log | Files | Refs | Archive | README

CMakeLists.txt (2391B)

      1 # Find all the *.cpp files within the current source directory, and sort the list
      2 file(GLOB TOOLS_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp")
      3 sort_list(TOOLS_SRCS)
      4 
      5 # Set all the files to use C++ as well as set their compile flags
      6 set_source_files_properties(${TOOLS_SRCS} PROPERTIES LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}")
      7 
      8 # Iterate through all the source files
      9 foreach(SRC ${TOOLS_SRCS})
     10   # Convert the source file extension to have no extension
     11   string(REGEX REPLACE "\\.cpp$" "" EXE ${SRC})
     12   # Calculate the header file dependencies for the given source file
     13   calculate_depends(${SRC})
     14   # Only continue if this file isn't skipped
     15   if(NOT SKIP)
     16     # Generate the executable and set its linker flags, also set it to depend on the main Anope executable to be built beforehand
     17     add_executable(${EXE} ${SRC})
     18     set_target_properties(${EXE} PROPERTIES LINKER_LANGUAGE CXX LINK_FLAGS "${LDFLAGS}")
     19     add_dependencies(${EXE} ${PROGRAM_NAME})
     20     # Only for Windows, set anopesmtp to require the wsock32 library
     21     if(WIN32 AND ${EXE} STREQUAL anopesmtp)
     22       target_link_libraries(${EXE} wsock32)
     23     endif(WIN32 AND ${EXE} STREQUAL anopesmtp)
     24     if(${CMAKE_SYSTEM_NAME} STREQUAL "SunOS" AND ${EXE} STREQUAL anopesmtp)
     25       target_link_libraries(${EXE} socket nsl)
     26     endif(${CMAKE_SYSTEM_NAME} STREQUAL "SunOS" AND ${EXE} STREQUAL anopesmtp)
     27     # Set the executable to be installed to the bin directory under the main directory
     28     install(TARGETS ${EXE}
     29       DESTINATION ${BIN_DIR}
     30     )
     31     # Add the executable to the list of files for CPack to ignore
     32     get_target_property(EXE_BINARY ${EXE} LOCATION)
     33     get_filename_component(EXE_BINARY ${EXE_BINARY} NAME)
     34     add_to_cpack_ignored_files("${EXE_BINARY}$" TRUE)
     35   endif(NOT SKIP)
     36 endforeach(SRC)
     37 
     38 # If not on Windows, generate anoperc and install it along with mydbgen
     39 if(NOT WIN32)
     40   configure_file(${Anope_SOURCE_DIR}/src/tools/anoperc.in ${Anope_BINARY_DIR}/src/tools/anoperc)
     41   install (PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/anoperc
     42     DESTINATION ${BIN_DIR}
     43   )
     44   install (PROGRAMS geoipupdate.sh
     45     DESTINATION ${BIN_DIR}
     46   )
     47 endif(NOT WIN32)
     48 
     49 # On non-Windows platforms, if RUNGROUP is set, change the permissions of the tools directory
     50 if(NOT WIN32 AND RUNGROUP)
     51   install(CODE "execute_process(COMMAND ${CHMOD} 2770 \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin\")")
     52 endif(NOT WIN32 AND RUNGROUP)