Commit 30846547 authored by Arnaud Blanchard's avatar Arnaud Blanchard
Browse files

Fix problem of compilation

parent c4d56ab9
......@@ -10,43 +10,32 @@
# The fact that you are presently reading this means that you have had knowledge of the CeCILL v2.1 license and that you accept its terms.
cmake_minimum_required(VERSION 2.6)
project(blc_processes)
add_definitions(-Wall -Wextra -Wno-multichar)
set(CMAKE_MACOSX_RPATH 0) #avoid warning in MACOSX
get_filename_component(PROJECT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) #The name of the project is the basename of the directory
project(${PROJECT_NAME})
get_filename_component(BLAAR_DIR ${CMAKE_SOURCE_DIR} PATH)
find_package(blc_core REQUIRED)
find_package(blc_channel REQUIRED)
find_package(blc_program REQUIRED)
if (NOT TARGET shared_blc_core)
add_subdirectory(${BLAAR_DIR}/blc_core blc_core)
endif()
if (NOT TARGET shared_blc_channel)
add_subdirectory(${BLAAR_DIR}/blc_channel blc_channel)
endif()
if (NOT TARGET shared_blc_program)
add_subdirectory(${BLAAR_DIR}/blc_program blc_program)
endif()
include_directories(include ${BLC_CORE_INCLUDE_DIRS} ${BLC_CHANNEL_INCLUDE_DIRS} ${BLC_PROGRAM_INCLUDE_DIRS})
#source files
set(sources src/blc_processes.cpp)
add_definitions(${BL_DEFINITIONS})
include_directories(include ${BL_INCLUDE_DIRS})
#create the library
add_library(shared_blc_processes SHARED ${sources})
add_library(static_blc_processes STATIC ${sources})
target_link_libraries(shared_blc_processes shared_blc_program shared_blc_channel shared_blc_core)
set(BLC_PROCESSES_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include PARENT_SCOPE)
set(BLC_PROCESSES_LIBRARIES shared_blc_processes PARENT_SCOPE)
#define the shared library
add_library(blc_processes SHARED ${sources})
target_link_libraries(blc_processes ${BL_LIBRARIES})
#Both librairies have the same name only the extension will change depending on the OS
set_target_properties(shared_blc_processes PROPERTIES OUTPUT_NAME blc_processes)
add_library(static_blc_processes STATIC ${sources})
set_target_properties(static_blc_processes PROPERTIES OUTPUT_NAME blc_processes)
#Describe what will be to install or in the package
install(DIRECTORY include/ DESTINATION include)
install(TARGETS static_blc_processes shared_blc_processes DESTINATION lib)
#Describe what will be to install or in the package by default the prefix (CMAKE_INSTALL_PREFIX) is '/usr/’
install(DIRECTORY include/ DESTINATION include/${PROJECT_NAME})
install(TARGETS ${PROJECT_NAME} static_${PROJECT_NAME} DESTINATION lib)
install(FILES ${PROJECT_NAME}-config.cmake DESTINATION share/${PROJECT_NAME})
#define a rule to make debian .deb package
set(CPACK_GENERATOR "DEB")
......
......@@ -13,7 +13,7 @@
#include "blc_core.h"
#include <unistd.h> //read
#include <unistd.h> //read
#include <errno.h> //EINTR
#include <sys/wait.h> //waitpid
......@@ -222,7 +222,6 @@ void blc_processes_refresh(blc_process *processes, int processes_nb)
{
line=mem.chars+pos;
while((ret=sscanf(line, " %d %f %d %f %"STRINGIFY_CONTENT(LINE_MAX)"[^\n]\n%n", &tmp_process.pid, &tmp_process.cpu_percent, &tmp_process.mem, &tmp_process.mem_percent, tmp_process.full_command_line, &length))==4){
FOR_EACH_INV(process, processes, processes_nb) if (process->pid == tmp_process.pid) *process=tmp_process; //not very efficient
line+=length;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment