view cinst/CMakeLists.txt @ 1264:3cd8dd706aaa

Add possibility to build with CLANG and document it. This only works for now with the c parts of the code.
author Andre Heinecke <andre.heinecke@intevation.de>
date Fri, 26 Sep 2014 17:59:49 +0200
parents 60927efa48cc
children 265583011f24
line wrap: on
line source
# Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
# Software engineering by Intevation GmbH
#
# This file is Free Software under the GNU GPL (v>=2)
# and comes with ABSOLUTELY NO WARRANTY!
# See LICENSE.txt for details.

cmake_minimum_required(VERSION 2.8)

set(CMAKE_AUTOMOC OFF)

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../common)

set(trustbridge-certificate-installer_SOURCES
    ${CMAKE_CURRENT_SOURCE_DIR}/windowsstore.c
    ${CMAKE_CURRENT_SOURCE_DIR}/nssstore_linux.c
    ${CMAKE_CURRENT_SOURCE_DIR}/nssstore_win.c
    ${CMAKE_CURRENT_SOURCE_DIR}/certificate-installer.c
)
if (WIN32)
   # Add asInvoker manifest to avoid windows heuristics
   # that want to always run an -installer with admin rights.
    set(trustbridge-certificate-installer_SOURCES
       ${trustbridge-certificate-installer_SOURCES}
       ${CMAKE_CURRENT_SOURCE_DIR}/asInvoker.rc)
endif()


add_executable(trustbridge-certificate-installer ${trustbridge-certificate-installer_SOURCES})

if (WIN32)
   set(WIN_EXTRA_LIBS -lcrypt32 -luserenv -lshell32)
endif(WIN32)

target_link_libraries(trustbridge-certificate-installer
   trustbridge_common
   ${PROFILING_LIBS}
   ${POLARSSL_LIBRARIES}
   ${WIN_EXTRA_LIBS})

install(TARGETS trustbridge-certificate-installer DESTINATION bin)
if (WIN32)
   add_custom_command(
      TARGET trustbridge-certificate-installer
      POST_BUILD
      COMMAND ${CMAKE_STRIP} trustbridge-certificate-installer.exe
   )
   if (NOT RELEASE_BUILD)
      add_custom_command(
         TARGET trustbridge-certificate-installer
         POST_BUILD
         COMMAND ${OSSLSIGNCODE_EXECUTABLE} sign -certs ${CMAKE_SOURCE_DIR}/ui/tests/data/codesign/codesigning.pem
         -key ${CMAKE_SOURCE_DIR}/ui/tests/data/codesign/codesigning.key
         -h sha256 -in ${CMAKE_CURRENT_BINARY_DIR}/trustbridge-certificate-installer.exe
         -out ${CMAKE_CURRENT_BINARY_DIR}/trustbridge-certificate-installer-signed.exe &&
         mv ${CMAKE_CURRENT_BINARY_DIR}/trustbridge-certificate-installer-signed.exe ${CMAKE_CURRENT_BINARY_DIR}/trustbridge-certificate-installer.exe
         )
    endif()
else()
   add_custom_command(
      TARGET trustbridge-certificate-installer
      POST_BUILD
      COMMAND strip trustbridge-certificate-installer
   )
endif()

# ----------------------------------------------------------------------
# trustbridge-nss-installer nss store specific certificate installer:
set(trustbridge-nss-installer_SOURCES
 ${CMAKE_CURRENT_SOURCE_DIR}/nss-secitemlist.c
 ${CMAKE_CURRENT_SOURCE_DIR}/nss-installer.c
 )

if (WIN32)
   # Add asInvoker manifest to avoid windows heuristics
   # that want to always run an -installer with admin rights.
    set(trustbridge-nss-installer_SOURCES
       ${trustbridge-nss-installer_SOURCES}
       ${CMAKE_CURRENT_SOURCE_DIR}/asInvoker.rc)
endif()


if(WIN32 OR NSS_FOUND)
   include_directories(${NSS_INCLUDE_DIRS})
   add_executable(trustbridge-nss-installer ${trustbridge-nss-installer_SOURCES})
   target_link_libraries(trustbridge-nss-installer
      trustbridge_common
      ${POLARSSL_LIBRARIES}
      ${NSS_LIBRARIES}
      ${PROFILING_LIBS})
   set_target_properties(trustbridge-nss-installer PROPERTIES COMPILE_FLAGS "-std=c99")
   install(TARGETS trustbridge-nss-installer DESTINATION bin)

   if (WIN32)
      add_custom_command(
         TARGET trustbridge-nss-installer
         POST_BUILD
         COMMAND ${CMAKE_STRIP} trustbridge-nss-installer.exe
      )
      if (NOT RELEASE_BUILD)
         add_custom_command(
            TARGET trustbridge-nss-installer
            POST_BUILD
            COMMAND ${OSSLSIGNCODE_EXECUTABLE} sign -certs ${CMAKE_SOURCE_DIR}/ui/tests/data/codesign/codesigning.pem
            -key ${CMAKE_SOURCE_DIR}/ui/tests/data/codesign/codesigning.key
            -h sha256 -in ${CMAKE_CURRENT_BINARY_DIR}/trustbridge-nss-installer.exe
            -out ${CMAKE_CURRENT_BINARY_DIR}/trustbridge-nss-installer-signed.exe &&
            mv ${CMAKE_CURRENT_BINARY_DIR}/trustbridge-nss-installer-signed.exe ${CMAKE_CURRENT_BINARY_DIR}/trustbridge-nss-installer.exe
            )
       endif()
   else()
      add_custom_command(
         TARGET trustbridge-nss-installer
         POST_BUILD
         COMMAND strip trustbridge-nss-installer
      )
   endif()
else()
   message(STATUS "WARNING: Could not find nss. trustbridge-nss-installer cert installer will not be build!")
endif()

http://wald.intevation.org/projects/trustbridge/