Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake CPM building #142

Open
russkel opened this issue Aug 17, 2024 · 0 comments
Open

cmake CPM building #142

russkel opened this issue Aug 17, 2024 · 0 comments

Comments

@russkel
Copy link
Contributor

russkel commented Aug 17, 2024

Hi, not really a feature request, just putting this here in case people want this.

After "installing" (https://github.com/cpm-cmake/CPM.cmake) the CPM.cmake file into your project:

include(cmake/CPM.cmake)

CPMAddPackage(
  NAME finalcut
  GIT_REPOSITORY https://github.com/gansm/finalcut.git
  GIT_TAG 0.9.1
  DOWNLOAD_ONLY YES
)

if (finalcut_ADDED)
  # finalcut has no CMake support, so we create our own target
  # needs libgpm-dev libncurses-dev
  include(FindPkgConfig)
#  pkg_check_modules(gpm gpm IMPORTED_TARGET) # looks like gpm does not have a .pc file on ubuntu
  pkg_check_modules(ncurses ncurses IMPORTED_TARGET)

  FILE(GLOB_RECURSE finalcut_sources ${finalcut_SOURCE_DIR}/final/*.cpp)
  add_library(finalcut STATIC ${finalcut_sources})

  target_link_libraries(finalcut
#          PkgConfig::gpm
          gpm
          PkgConfig::ncurses
  )
  target_include_directories(finalcut
          PUBLIC
          $<BUILD_INTERFACE:${finalcut_SOURCE_DIR}>
  )

  target_compile_definitions(finalcut PUBLIC COMPILE_FINAL_CUT F_HAVE_LIBGPM=1)
endif()

You can then simply use finalcut target to link to your executables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant