github.com/jlmucb/cloudproxy@v0.0.0-20170830161738-b5aa0b619bc4/src/tpm2/CMakeLists.txt (about) 1 # Copyright 2014 Google Inc. All rights reserved. 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 15 cmake_minimum_required(VERSION 2.8.12) 16 project(tpm2 C CXX ASM) 17 18 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 19 find_package(Protobuf REQUIRED) 20 include_directories(${PROTOBUF_INCLUDE_DIRS}) 21 22 # Keep a set of common flags and include directories for evmm and bootstrap. 23 set(WARNING_FLAGS "-Wall -Wno-strict-aliasing -Wno-deprecated") 24 set(LANG_FLAGS "-std=c++11") 25 set(CMAKE_C_FLAGS "${WARNING_FLAGS}") 26 set(CMAKE_CXX_FLAGS "${WARNING_FLAGS} ${LANG_FLAGS}") 27 28 set(CMAKE_C_FLAGS_DEBUG "-g -O1") 29 set(CMAKE_C_FLAGS_RELEASE "-g -O3") 30 set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG}) 31 set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE}) 32 33 set(TPM2_PROTO 34 tpm2.proto 35 ) 36 37 PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS ${TPM2_PROTO}) 38 39 set(TPM2_SOURCES 40 tpm2_lib.cc 41 conversions.cc 42 openssl_helpers.cc 43 quote_protocol.cc 44 ) 45 46 set(TPM2_HEADERS 47 conversions.h 48 openssl_helpers.h 49 quote_protocol.h 50 tpm12.h 51 tpm20.h 52 tpm2_lib.h 53 tpm2_types.h 54 ) 55 56 include_directories(${CMAKE_SOURCE_DIR}) 57 include_directories(${CMAKE_SOURCE_DIR}/../third_party/google-glog/src) 58 include_directories(${CMAKE_SOURCE_DIR}/../third_party/gflags/src) 59 60 # This is added to get the right path for the protobuf generated header files. 61 include_directories(${CMAKE_BINARY_DIR}) 62 63 add_library(tpm2 STATIC 64 ${PROTO_SRCS} 65 ${PROTO_HDRS} 66 ${TPM2_SOURCES} 67 ${TPM2_HEADERS} 68 ) 69 70 # TODO(tmroeder): add checks for OpenSSL, libvirt, and libtspi. 71 target_link_libraries(tpm2 72 gflags 73 protobuf 74 crypto 75 ssl 76 ) 77 78 add_executable(tpm2_util tpm2_util.cc) 79 target_link_libraries(tpm2_util tpm2) 80 81 add_executable(GeneratePolicyKey GeneratePolicyKey.cc) 82 target_link_libraries(GeneratePolicyKey tpm2) 83 84 add_executable(CloudProxySignEndorsementKey CloudProxySignEndorsementKey.cc) 85 target_link_libraries(CloudProxySignEndorsementKey tpm2) 86 87 add_executable(GetEndorsementKey GetEndorsementKey.cc) 88 target_link_libraries(GetEndorsementKey tpm2) 89 90 add_executable(SelfSignPolicyCert SelfSignPolicyCert.cc) 91 target_link_libraries(SelfSignPolicyCert tpm2) 92 93 add_executable(CreateAndSaveCloudProxyKeyHierarchy CreateAndSaveCloudProxyKeyHierarchy.cc) 94 target_link_libraries(CreateAndSaveCloudProxyKeyHierarchy tpm2) 95 96 add_executable(RestoreCloudProxyKeyHierarchy RestoreCloudProxyKeyHierarchy.cc) 97 target_link_libraries(RestoreCloudProxyKeyHierarchy tpm2) 98 99 add_executable(ClientGenerateProgramKeyRequest ClientGenerateProgramKeyRequest.cc) 100 target_link_libraries(ClientGenerateProgramKeyRequest tpm2) 101 102 add_executable(ServerSignProgramKeyRequest ServerSignProgramKeyRequest.cc) 103 target_link_libraries(ServerSignProgramKeyRequest tpm2) 104 105 add_executable(ClientGetProgramKeyCert ClientGetProgramKeyCert.cc) 106 target_link_libraries(ClientGetProgramKeyCert tpm2) 107 108 add_executable(SigningInstructions SigningInstructions.cc) 109 target_link_libraries(SigningInstructions tpm2) 110