Skip to content

Commit

Permalink
fix: remove rpm and popt from windows compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
ncvicchi committed Sep 5, 2024
1 parent d84704b commit 8700139
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 22 deletions.
37 changes: 21 additions & 16 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,27 @@ project(wazuh-agent)
include(cmake/CommonSettings.cmake)
set_common_settings()

add_subdirectory(external/rpm)

add_custom_target(
build_procps_lib ALL
COMMAND ${CMAKE_MAKE_PROGRAM} -C ${SRC_FOLDER}/src/external/procps
COMMENT "Buiding procps library"
)

set(LIBDB_DIR "${SRC_FOLDER}/src/external/libdb")
add_custom_target(
build_libdb ALL
COMMAND ${CMAKE_COMMAND} -E echo "Building libdb"
COMMAND ${CMAKE_COMMAND} -E chdir ${LIBDB_DIR}/build_unix ${LIBDB_DIR}/dist/configure CFLAGS="-fPIC"
COMMAND ${CMAKE_COMMAND} -E chdir ${LIBDB_DIR}/build_unix ${CMAKE_MAKE_PROGRAM}
COMMENT "Building libdb"
)
if (LINUX)
if(NOT CMAKE_CHECK_CENTOS5)
add_subdirectory(external/rpm)
endif()

set(LIBDB_DIR "${SRC_FOLDER}/src/external/libdb")
add_custom_target(
build_libdb ALL
COMMAND ${CMAKE_COMMAND} -E echo "Building libdb"
COMMAND ${CMAKE_COMMAND} -E chdir ${LIBDB_DIR}/build_unix ${LIBDB_DIR}/dist/configure CFLAGS="-fPIC"
COMMAND ${CMAKE_COMMAND} -E chdir ${LIBDB_DIR}/build_unix ${CMAKE_MAKE_PROGRAM}
COMMENT "Building libdb"
)

add_custom_target(
build_procps_lib ALL
COMMAND ${CMAKE_MAKE_PROGRAM} -C ${SRC_FOLDER}/src/external/procps
COMMENT "Buiding procps library"
)

endif()

add_subdirectory(common)
add_subdirectory(modules)
Expand Down
22 changes: 16 additions & 6 deletions src/common/data_provider/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -231,19 +231,29 @@ elseif(APPLE)
target_link_libraries(sysinfo cjson ${SRC_FOLDER}/external/libplist/bin/lib/libplist-2.0.a ${iokit_lib} ${corefoundation_lib})
endif(CMAKE_SYSTEM_NAME STREQUAL "Windows")

find_library(POPT_LIBRARY libpopt)
if(NOT POPT_LIBRARY)
message(FATAL_ERROR "libpopt library not found! Aborting...")
if (LINUX)
if(NOT CMAKE_CHECK_CENTOS5)
find_library(POPT_LIBRARY libpopt.a)
set(RPM_LIBRARY rpm)
set(PROC_LIBRARY proc)
set(ARCHIVE_LIBRARY LibArchive::LibArchive)
set(PROC_LIBRARY proc)
else()
set(RPM_LIBRARY "")
set(PROC_LIBRARY "")
set(ARCHIVE_LIBRARY "")
set(PROC_LIBRARY proc)
endif()
endif()
target_link_libraries(sysinfo
networkHelper
nlohmann_json::nlohmann_json
cjson
unofficial::sqlite3::sqlite3
LibArchive::LibArchive
${ARCHIVE_LIBRARY}
${POPT_LIBRARY}
rpm
proc
${RPM_LIBRARY}
${PROC_LIBRARY}
${LUA_LIBRARIES})

if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
Expand Down

0 comments on commit 8700139

Please sign in to comment.