CMakeLists.txt 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. set(libs
  2. ${mbedtls_target}
  3. )
  4. if(USE_PKCS11_HELPER_LIBRARY)
  5. set(libs ${libs} pkcs11-helper)
  6. endif(USE_PKCS11_HELPER_LIBRARY)
  7. if(ENABLE_ZLIB_SUPPORT)
  8. set(libs ${libs} ${ZLIB_LIBRARIES})
  9. endif(ENABLE_ZLIB_SUPPORT)
  10. find_library(FUZZINGENGINE_LIB FuzzingEngine)
  11. if(FUZZINGENGINE_LIB)
  12. project(fuzz CXX)
  13. endif()
  14. set(executables_no_common_c
  15. fuzz_privkey
  16. fuzz_pubkey
  17. fuzz_x509crl
  18. fuzz_x509crt
  19. fuzz_x509csr
  20. )
  21. set(executables_with_common_c
  22. fuzz_client
  23. fuzz_dtlsclient
  24. fuzz_dtlsserver
  25. fuzz_server
  26. )
  27. foreach(exe IN LISTS executables_no_common_c executables_with_common_c)
  28. set(exe_sources ${exe}.c $<TARGET_OBJECTS:mbedtls_test>)
  29. if(NOT FUZZINGENGINE_LIB)
  30. list(APPEND exe_sources onefile.c)
  31. endif()
  32. # This emulates "if ( ... IN_LIST ... )" which becomes available in CMake 3.3
  33. list(FIND executables_with_common_c ${exe} exe_index)
  34. if(${exe_index} GREATER -1)
  35. list(APPEND exe_sources common.c)
  36. endif()
  37. add_executable(${exe} ${exe_sources})
  38. if (NOT FUZZINGENGINE_LIB)
  39. target_link_libraries(${exe} ${libs})
  40. else()
  41. target_link_libraries(${exe} ${libs} FuzzingEngine)
  42. SET_TARGET_PROPERTIES(${exe} PROPERTIES LINKER_LANGUAGE CXX)
  43. endif()
  44. endforeach()