tomcrypt/CMakeLists.txt

72 lines
2.4 KiB
CMake
Raw Permalink Normal View History

cmake_minimum_required(VERSION 3.0)
2019-07-06 16:49:58 -04:00
project(libtomcrypt)
IF (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
ADD_DEFINITIONS(-DLTC_NO_ROLC)
ENDIF ()
2019-07-02 15:45:47 -04:00
ADD_DEFINITIONS(-DLTC_NO_PROTOTYPES)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
ADD_DEFINITIONS(-DLTC_SOURCE)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src/headers)
SET (ALL_HEADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/src/headers/tomcrypt.h
${CMAKE_CURRENT_SOURCE_DIR}/src/headers/tomcrypt_cfg.h
${CMAKE_CURRENT_SOURCE_DIR}/src/headers/tomcrypt_custom.h
${CMAKE_CURRENT_SOURCE_DIR}/src/headers/tomcrypt_mac.h
${CMAKE_CURRENT_SOURCE_DIR}/src/headers/tomcrypt_math.h
${CMAKE_CURRENT_SOURCE_DIR}/src/headers/tomcrypt_pk.h
${CMAKE_CURRENT_SOURCE_DIR}/src/headers/tomcrypt_prng.h
${CMAKE_CURRENT_SOURCE_DIR}/src/headers/tomcrypt_argchk.h
${CMAKE_CURRENT_SOURCE_DIR}/src/headers/tomcrypt_cipher.h
${CMAKE_CURRENT_SOURCE_DIR}/src/headers/tomcrypt_hash.h
${CMAKE_CURRENT_SOURCE_DIR}/src/headers/tomcrypt_macros.h
${CMAKE_CURRENT_SOURCE_DIR}/src/headers/tomcrypt_misc.h
${CMAKE_CURRENT_SOURCE_DIR}/src/headers/tomcrypt_pkcs.h
)
file(GLOB_RECURSE ALL_SOURCE_FILES src/*.c)
if (MSVC)
message(STATUS "Detect MSVC compiler...")
SET(MSVC_LIKE_COMPILER ON)
set(CompilerFlags
CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE
2019-07-06 16:49:58 -04:00
CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
2019-07-06 16:51:31 -04:00
CMAKE_C_FLAGS_RELWITHDEBINFO
2019-07-06 16:49:58 -04:00
)
foreach(CompilerFlag ${CompilerFlags})
string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
endforeach()
elseif ("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xIntel")
if(WIN32)
message(STATUS "Detect Intel compiler and handle it like MSVC...")
SET(MSVC_LIKE_COMPILER ON)
endif ()
endif ()
SET_SOURCE_FILES_PROPERTIES(ALL_HEADER_FILES PROPERTIES HEADER_FILE_ONLY TRUE)
LIST(APPEND ALL_SOURCE_FILES ${ALL_HEADER_FILES})
2019-07-02 15:51:48 -04:00
ADD_LIBRARY(tomcrypt_static STATIC ${ALL_SOURCE_FILES})
set_target_properties(tomcrypt_static PROPERTIES OUTPUT_NAME "tomcrypt")
2019-07-02 15:51:48 -04:00
INSTALL(TARGETS tomcrypt_static
ARCHIVE DESTINATION "lib"
LIBRARY DESTINATION "lib"
RUNTIME DESTINATION "bin"
)
2019-07-02 15:54:51 -04:00
INSTALL(FILES ${ALL_HEADER_FILES} DESTINATION "include")
SET(MSVC_LIKE_COMPILER OFF)