Warning, /libraries/qca/src/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 include(CheckIncludeFiles)
0002 CHECK_INCLUDE_FILES(sys/filio.h HAVE_SYS_FILIO_H)
0003 IF(HAVE_SYS_FILIO_H)
0004   ADD_DEFINITIONS(-DHAVE_SYS_FILIO_H)
0005 ENDIF(HAVE_SYS_FILIO_H)
0006 
0007 INCLUDE(CheckCXXSourceCompiles)
0008 CHECK_CXX_SOURCE_COMPILES("
0009 # include <stdlib.h>
0010 # include <sys/mman.h>
0011 int main() { void *f = 0; return mlock(f,8); }
0012 " MLOCK_TAKES_VOID)
0013 if(NOT MLOCK_TAKES_VOID)
0014   MESSAGE(STATUS "mlock(2) does not take a void *")
0015   ADD_DEFINITIONS(-DMLOCK_NOT_VOID_PTR)
0016 endif()
0017 
0018 if(DEVELOPER_MODE)
0019   add_definitions(-DQCA_PLUGIN_PATH="${CMAKE_BINARY_DIR}/lib/${QCA_LIB_NAME}")
0020 else()
0021   if(USE_RELATIVE_PATHS)
0022     add_definitions(-DQCA_PLUGIN_PATH="${QCA_PREFIX_INSTALL_DIR}/${QCA_PLUGINS_INSTALL_DIR}")
0023   else()
0024     add_definitions(-DQCA_PLUGIN_PATH="${QCA_PLUGINS_INSTALL_DIR}")
0025   endif()
0026 endif()
0027 
0028 # base source files
0029 
0030 
0031 SET( SOURCES
0032         qca_tools.cpp
0033         qca_plugin.cpp
0034         qca_textfilter.cpp
0035         qca_basic.cpp
0036         support/logger.cpp
0037         qca_cert.cpp
0038         qca_core.cpp
0039         qca_default.cpp
0040         qca_keystore.cpp
0041         qca_publickey.cpp
0042         qca_safeobj.cpp
0043         qca_safetimer.cpp
0044         qca_securelayer.cpp
0045         qca_securemessage.cpp
0046         support/qpipe.cpp
0047         support/console.cpp
0048         support/synchronizer.cpp
0049         support/dirwatch.cpp
0050         support/syncthread.cpp
0051 )
0052 
0053 IF (WIN32)
0054   SET( SOURCES ${SOURCES} qca_systemstore_win.cpp )
0055 elseif(APPLE AND NOT IOS)
0056   set( SOURCES ${SOURCES} qca_systemstore_mac.cpp)
0057 else()
0058   SET( SOURCES ${SOURCES} qca_systemstore_flatfile.cpp )
0059 endif()
0060 
0061 # Support files
0062 #SET( qca_HEADERS ${qca_HEADERS} support/dirwatch/dirwatch_p.h )
0063 
0064 # Botan tools
0065 SET( botan_BASE botantools/botan )
0066 
0067 
0068 INCLUDE_DIRECTORIES(support ${botan_BASE} )
0069 
0070 ADD_DEFINITIONS(
0071         -DBOTAN_TYPES_QT
0072         -DBOTAN_NO_INIT_H
0073         -DBOTAN_NO_CONF_H
0074         -DBOTAN_TOOLS_ONLY
0075         -DBOTAN_MINIMAL_BIGINT
0076 )
0077 
0078 ADD_DEFINITIONS(
0079   -DBOTAN_MP_WORD_BITS=32
0080   -DBOTAN_KARAT_MUL_THRESHOLD=12
0081   -DBOTAN_KARAT_SQR_THRESHOLD=12
0082   -DBOTAN_EXT_MUTEX_QT
0083 )
0084 
0085 if(UNIX)
0086    ADD_DEFINITIONS( -DBOTAN_EXT_ALLOC_MMAP)
0087 endif()
0088 
0089 SET( botan_SOURCES
0090         ${botan_BASE}/util.cpp
0091         ${botan_BASE}/exceptn.cpp
0092         ${botan_BASE}/mutex.cpp
0093         ${botan_BASE}/mux_qt/mux_qt.cpp
0094         ${botan_BASE}/charset.cpp
0095         ${botan_BASE}/defalloc.cpp
0096         ${botan_BASE}/mp_comba.cpp
0097         ${botan_BASE}/mp_mul.cpp
0098         ${botan_BASE}/mp_shift.cpp
0099         ${botan_BASE}/mp_misc.cpp
0100         ${botan_BASE}/divide.cpp
0101         ${botan_BASE}/big_base.cpp
0102         ${botan_BASE}/big_code.cpp
0103         ${botan_BASE}/big_io.cpp
0104         ${botan_BASE}/big_ops2.cpp
0105         ${botan_BASE}/big_ops3.cpp
0106         ${botan_BASE}/bit_ops.cpp
0107         ${botan_BASE}/libstate.cpp
0108         ${botan_BASE}/mem_pool.cpp
0109         ${botan_BASE}/modules.cpp
0110         ${botan_BASE}/mp_asm.cpp
0111         ${botan_BASE}/mp_mulop.cpp
0112         ${botan_BASE}/parsing.cpp
0113 )
0114 
0115 IF (UNIX)
0116   SET( botan_SOURCES ${botan_SOURCES} ${botan_BASE}/ml_unix/mlock.cpp)
0117   SET( botan_SOURCES ${botan_SOURCES} ${botan_BASE}/alloc_mmap/mmap_mem.cpp)
0118 ENDIF (UNIX)
0119 
0120 IF(WIN32)
0121   SET( botan_SOURCES ${botan_SOURCES} ${botan_BASE}/ml_win32/mlock.cpp)
0122 ENDIF(WIN32)
0123 
0124 SET( SOURCES ${SOURCES} ${botan_SOURCES})
0125 
0126 add_library(${QCA_LIB_NAME} ${SOURCES}  ${public_HEADERS})
0127 target_link_libraries(${QCA_LIB_NAME} PUBLIC Qt${QT_MAJOR_VERSION}::Core)
0128 if(BUILD_WITH_QT6)
0129   target_link_libraries(${QCA_LIB_NAME} PRIVATE Qt6::Core5Compat)
0130 endif()
0131 
0132 if(WIN32)
0133         TARGET_LINK_LIBRARIES(${QCA_LIB_NAME} PRIVATE crypt32 ws2_32)
0134 endif()
0135 
0136 if(APPLE AND NOT IOS)
0137   set(COREFOUNDATION_LIBRARY "-framework CoreFoundation")
0138   set(COREFOUNDATION_LIBRARY_SECURITY "-framework Security")
0139   TARGET_LINK_LIBRARIES(${QCA_LIB_NAME} PRIVATE ${COREFOUNDATION_LIBRARY} ${COREFOUNDATION_LIBRARY_SECURITY})
0140 
0141   if(NOT USE_RELATIVE_PATHS)
0142     set_target_properties(${QCA_LIB_NAME} PROPERTIES
0143                           INSTALL_NAME_DIR "${QCA_LIBRARY_INSTALL_DIR}"
0144     )
0145   endif()
0146 endif()
0147 
0148 if(NOT ANDROID)
0149   set_target_properties(${QCA_LIB_NAME} PROPERTIES
0150                         VERSION ${QCA_LIB_MAJOR_VERSION}.${QCA_LIB_MINOR_VERSION}.${QCA_LIB_PATCH_VERSION}
0151                         SOVERSION ${QCA_LIB_MAJOR_VERSION}
0152                         )
0153 endif()
0154 
0155 set_target_properties(${QCA_LIB_NAME} PROPERTIES
0156                       DEFINE_SYMBOL QCA_MAKEDLL
0157                       PUBLIC_HEADER "${public_HEADERS}"
0158                       FRAMEWORK ${OSX_FRAMEWORK}
0159                       FRAMEWORK_VERSION ${QCA_LIB_MAJOR_VERSION}
0160                       EXPORT_NAME ${QCA_LIB_NAME}
0161                       )
0162 
0163 if(NOT DEVELOPER_MODE)
0164   # Do not split 'PUBLIC_HEADER ...' line. It means install headers to folder
0165   # and set this folder as -I flag for imported target.
0166   # Also EXPORT doesn't actually install any files. It only created a new target.
0167   install(TARGETS ${QCA_LIB_NAME} EXPORT ${QCA_CONFIG_NAME_BASE}Targets
0168           LIBRARY DESTINATION "${QCA_LIBRARY_INSTALL_DIR}"
0169           RUNTIME DESTINATION "${QCA_BINARY_INSTALL_DIR}"
0170           ARCHIVE DESTINATION "${QCA_LIBRARY_INSTALL_DIR}"
0171           FRAMEWORK DESTINATION "${QCA_LIBRARY_INSTALL_DIR}"
0172           PUBLIC_HEADER DESTINATION "${QCA_FULL_INCLUDE_INSTALL_DIR}" INCLUDES DESTINATION "${QCA_FULL_INCLUDE_INSTALL_DIR}"
0173   )
0174   install_pdb(${QCA_LIB_NAME} ${QCA_BINARY_INSTALL_DIR})
0175 endif()
0176