Skip to content
Snippets Groups Projects
CMakeLists.txt 1.33 KiB
Newer Older
  • Learn to ignore specific revisions
  • cmake_minimum_required (VERSION 2.4)
    
    Corentin Chary's avatar
    Corentin Chary committed
    
    
    Corentin Chary's avatar
    Corentin Chary committed
    if(COMMAND cmake_policy)
          cmake_policy(SET CMP0003 NEW)
    endif(COMMAND cmake_policy)
    
    
    Corentin Chary's avatar
    Corentin Chary committed
    project (pkcs11 C)
    
    
    Corentin Chary's avatar
    Corentin Chary committed
    set(PKCS11_PROXY_SRCS gck-rpc-module.c gck-rpc-message.c gck-rpc-util.c egg-buffer.c)
    
    Leif Johansson's avatar
    Leif Johansson committed
    set(PKCS11_DAEMON_SRCS egg-buffer.c gck-rpc-daemon-standalone.c gck-rpc-dispatch.c gck-rpc-message.c gck-rpc-util.c syscall-reporter.c syscall-names.h)
    
    Corentin Chary's avatar
    Corentin Chary committed
    
    
    Corentin Chary's avatar
    Corentin Chary committed
    add_definitions(-Wall)
    
    Corentin Chary's avatar
    Corentin Chary committed
    add_library(pkcs11-proxy SHARED ${PKCS11_PROXY_SRCS})
    
    
    # Disable console when building Win32 binary in release mode
    if (WIN32)
      if("${CMAKE_BUILD_TYPE}" MATCHES "^Rel.*")
        set(GUI_TYPE WIN32)
      endif()
    endif()
    
    add_executable (pkcs11-daemon ${GUI_TYPE} ${PKCS11_DAEMON_SRCS})
    
    Corentin Chary's avatar
    Corentin Chary committed
    
    
    set_target_properties(pkcs11-proxy PROPERTIES VERSION 0.1 SOVERSION 0)
    
    
    Corentin Chary's avatar
    Corentin Chary committed
    if (WIN32)
      include_directories("ext/include")
    
      add_library(dl STATIC IMPORTED)
      set_property(TARGET dl PROPERTY
                   IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/ext/lib/libdl.a)
      target_link_libraries (pkcs11-daemon ws2_32)
      target_link_libraries (pkcs11-proxy ws2_32)
    
    Corentin Chary's avatar
    Corentin Chary committed
    
    target_link_libraries (pkcs11-proxy pthread)
    
    Corentin Chary's avatar
    Corentin Chary committed
    target_link_libraries (pkcs11-daemon dl pthread)
    
    
    install_targets (/lib pkcs11-proxy)
    install_targets (/bin pkcs11-daemon)
    
    Leif Johansson's avatar
    Leif Johansson committed
    
    add_custom_command(
       OUTPUT syscall-names.h 
       COMMAND ${CMAKE_SOURCE_DIR}/mksyscalls.sh
       WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})