1# Copyright (c) 2021 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14cmake_minimum_required(VERSION 3.10) 15 16project(securec) 17 18set(SOURCES 19 ${SECUREC_ROOT}/src/vsprintf_s.c 20 ${SECUREC_ROOT}/src/wmemmove_s.c 21 ${SECUREC_ROOT}/src/strncat_s.c 22 ${SECUREC_ROOT}/src/vsnprintf_s.c 23 ${SECUREC_ROOT}/src/fwscanf_s.c 24 ${SECUREC_ROOT}/src/scanf_s.c 25 ${SECUREC_ROOT}/src/strcat_s.c 26 ${SECUREC_ROOT}/src/sscanf_s.c 27 ${SECUREC_ROOT}/src/secureprintoutput_w.c 28 ${SECUREC_ROOT}/src/wmemcpy_s.c 29 ${SECUREC_ROOT}/src/wcsncat_s.c 30 ${SECUREC_ROOT}/src/secureprintoutput_a.c 31 ${SECUREC_ROOT}/src/secureinput_w.c 32 ${SECUREC_ROOT}/src/memcpy_s.c 33 ${SECUREC_ROOT}/src/fscanf_s.c 34 ${SECUREC_ROOT}/src/vswscanf_s.c 35 ${SECUREC_ROOT}/src/secureinput_a.c 36 ${SECUREC_ROOT}/src/sprintf_s.c 37 ${SECUREC_ROOT}/src/memmove_s.c 38 ${SECUREC_ROOT}/src/swscanf_s.c 39 ${SECUREC_ROOT}/src/snprintf_s.c 40 ${SECUREC_ROOT}/src/vscanf_s.c 41 ${SECUREC_ROOT}/src/vswprintf_s.c 42 ${SECUREC_ROOT}/src/wcscpy_s.c 43 ${SECUREC_ROOT}/src/vfwscanf_s.c 44 ${SECUREC_ROOT}/src/memset_s.c 45 ${SECUREC_ROOT}/src/wscanf_s.c 46 ${SECUREC_ROOT}/src/vwscanf_s.c 47 ${SECUREC_ROOT}/src/strtok_s.c 48 ${SECUREC_ROOT}/src/wcsncpy_s.c 49 ${SECUREC_ROOT}/src/vfscanf_s.c 50 ${SECUREC_ROOT}/src/vsscanf_s.c 51 ${SECUREC_ROOT}/src/wcstok_s.c 52 ${SECUREC_ROOT}/src/securecutil.c 53 ${SECUREC_ROOT}/src/gets_s.c 54 ${SECUREC_ROOT}/src/swprintf_s.c 55 ${SECUREC_ROOT}/src/strcpy_s.c 56 ${SECUREC_ROOT}/src/wcscat_s.c 57 ${SECUREC_ROOT}/src/strncpy_s.c 58) 59 60add_library(c_secshared ${PANDA_DEFAULT_LIB_TYPE} ${SOURCES}) 61target_include_directories(c_secshared PUBLIC ${SECUREC_ROOT}/include) 62target_compile_definitions(c_secshared PRIVATE NDEBUG SECUREC_SUPPORT_STRTOLD=1) 63if (PANDA_TARGET_WINDOWS) 64 target_compile_definitions(c_secshared PUBLIC _CRTBLD __LIBMSVCRT__) 65endif() 66target_compile_options(c_secshared PRIVATE -Wall -O1) 67 68if (PANDA_ENABLE_AFL) 69 add_library(c_secshared_fuzz ${PANDA_DEFAULT_LIB_TYPE} ${SOURCES}) 70 target_include_directories(c_secshared_fuzz PUBLIC ${SECUREC_ROOT}/include) 71 target_compile_definitions(c_secshared_fuzz PRIVATE NDEBUG SECUREC_SUPPORT_STRTOLD=1) 72 if (PANDA_TARGET_WINDOWS) 73 target_compile_definitions(c_secshared_fuzz PUBLIC _CRTBLD __LIBMSVCRT__) 74 endif() 75 target_compile_options(c_secshared_fuzz PRIVATE -Wall -O1 --afl_noopt) 76endif() 77