CMakeLists.txt (1460B)
1 set(libs 2 ${mbedtls_target} 3 ${CMAKE_THREAD_LIBS_INIT} 4 ) 5 6 find_library(FUZZINGENGINE_LIB FuzzingEngine) 7 if(FUZZINGENGINE_LIB) 8 project(fuzz CXX) 9 endif() 10 11 set(executables_no_common_c 12 fuzz_pubkey 13 fuzz_x509crl 14 fuzz_x509crt 15 fuzz_x509csr 16 fuzz_pkcs7 17 ) 18 add_dependencies(${programs_target} ${executables_no_common_c}) 19 20 set(executables_with_common_c 21 fuzz_privkey 22 fuzz_client 23 fuzz_dtlsclient 24 fuzz_dtlsserver 25 fuzz_server 26 ) 27 add_dependencies(${programs_target} ${executables_with_common_c}) 28 29 foreach(exe IN LISTS executables_no_common_c executables_with_common_c) 30 31 set(exe_sources ${exe}.c $<TARGET_OBJECTS:mbedtls_test>) 32 if(NOT FUZZINGENGINE_LIB) 33 list(APPEND exe_sources onefile.c) 34 endif() 35 36 # This emulates "if ( ... IN_LIST ... )" which becomes available in CMake 3.3 37 list(FIND executables_with_common_c ${exe} exe_index) 38 if(${exe_index} GREATER -1) 39 list(APPEND exe_sources common.c) 40 endif() 41 42 add_executable(${exe} ${exe_sources}) 43 target_include_directories(${exe} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../framework/tests/include 44 ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include) 45 46 if (NOT FUZZINGENGINE_LIB) 47 target_link_libraries(${exe} ${libs}) 48 else() 49 target_link_libraries(${exe} ${libs} FuzzingEngine) 50 SET_TARGET_PROPERTIES(${exe} PROPERTIES LINKER_LANGUAGE CXX) 51 endif() 52 53 endforeach()