diff --git a/CMakeLists.txt b/CMakeLists.txt index edafa29..9a08b8b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,9 +36,27 @@ if(_prefixes) ## - ## C2Core dependency and build + ## libssh2 for SshExec ## + set(CMAKE_POSITION_INDEPENDENT_CODE ON) # <- makes static libs PIC + set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) # libssh2 as static + set(BUILD_TESTING OFF CACHE BOOL "" FORCE) # no libssh2 tests + + include(FetchContent) + set(LIBSSH2_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) + set(LIBSSH2_BUILD_TESTS OFF CACHE BOOL "" FORCE) + FetchContent_Declare( + libssh2 + GIT_REPOSITORY https://github.com/libssh2/libssh2.git + GIT_TAG libssh2-1.11.1 + ) + FetchContent_MakeAvailable(libssh2) + + + ## + ## C2Core dependency and build + ## find_package(C2Core CONFIG REQUIRED) @@ -50,6 +68,9 @@ else() message(STATUS "CMAKE_PREFIX_PATH not provided; using fallback strategy") + add_definitions(-DBUILD_IMPLANT) + + ## ## Conan Dependencies ## @@ -61,15 +82,32 @@ else() include_directories(${CMAKE_INCLUDE_PATH}) - include_directories(thirdParty) - add_definitions(-DBUILD_IMPLANT) + ## + ## libssh2 for SshExec + ## + + set(CMAKE_POSITION_INDEPENDENT_CODE ON) # <- makes static libs PIC + set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) # libssh2 as static + set(BUILD_TESTING OFF CACHE BOOL "" FORCE) # no libssh2 tests + + include(FetchContent) + set(LIBSSH2_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) + set(LIBSSH2_BUILD_TESTS OFF CACHE BOOL "" FORCE) + FetchContent_Declare( + libssh2 + GIT_REPOSITORY https://github.com/libssh2/libssh2.git + GIT_TAG libssh2-1.11.1 + ) + FetchContent_MakeAvailable(libssh2) ## ## Build ## + include_directories(thirdParty) + add_subdirectory(libs) add_subdirectory(thirdParty) diff --git a/core b/core index 2f6652d..f152117 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 2f6652ddbb70378c187e06d64285175f2f5cfcfb +Subproject commit f152117dd2f98b86243bcd9e5c7673e05e825d9c