Projet de shell interactif minimaliste pour l'UV LP25
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CMakeLists.txt 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. cmake_minimum_required(VERSION 3.5)
  2. project(fish_shell)
  3. # We need thread support
  4. find_package(Threads REQUIRED)
  5. # Enable ExternalProject CMake module
  6. include(ExternalProject)
  7. # Download and install GoogleTest
  8. ExternalProject_Add(
  9. gtest
  10. URL https://github.com/google/googletest/archive/master.zip
  11. PREFIX ${CMAKE_CURRENT_BINARY_DIR}/gtest
  12. # Disable install step
  13. INSTALL_COMMAND ""
  14. )
  15. # Get GTest source and binary directories from CMake project
  16. ExternalProject_Get_Property(gtest source_dir binary_dir)
  17. # Create a libgtest target to be used as a dependency by test programs
  18. add_library(libgtest IMPORTED STATIC GLOBAL)
  19. add_dependencies(libgtest gtest)
  20. # Set libgtest properties
  21. set_target_properties(libgtest PROPERTIES
  22. "IMPORTED_LOCATION" "${binary_dir}/googlemock/gtest/libgtest.a"
  23. "IMPORTED_LINK_INTERFACE_LIBRARIES" "${CMAKE_THREAD_LIBS_INIT}"
  24. )
  25. # Create a libgmock target to be used as a dependency by test programs
  26. add_library(libgmock IMPORTED STATIC GLOBAL)
  27. add_dependencies(libgmock gtest)
  28. # Set libgmock properties
  29. set_target_properties(libgmock PROPERTIES
  30. "IMPORTED_LOCATION" "${binary_dir}/googlemock/libgmock.a"
  31. "IMPORTED_LINK_INTERFACE_LIBRARIES" "${CMAKE_THREAD_LIBS_INIT}"
  32. )
  33. include_directories(
  34. "${source_dir}/googletest/include"
  35. "${source_dir}/googlemock/include"
  36. )
  37. set(CMAKE_C_STANDARD 99)
  38. set(CMAKE_C_FLAGS "-Wall -Werror -pedantic -fpic -Wextra -Wshadow")
  39. set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g")
  40. set(SOURCE_FILES fish_shell/main.c fish_shell/fish_types.h fish_shell/fish_core.h fish_shell/fish_core.c fish_shell/fish_commands.c fish_shell/fish_commands.h fish_shell/fish_globbing.c fish_shell/fish_globbing.h fish_shell/fish_utils.c fish_shell/fish_utils.h fish_shell/fish_settings.c fish_shell/fish_settings.h)
  41. add_executable(fish ${SOURCE_FILES})
  42. target_link_libraries(fish pcre)
  43. #add_subdirectory(fish_shell)
  44. add_subdirectory(fish_shell_tests)
  45. enable_testing()
  46. add_test(NAME fish_tests
  47. COMMAND fish_tests
  48. )