Skip to content

Commit

Permalink
cmake: Use FindPackageHandleStandardArgs for finding procps.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrfonseca committed Mar 13, 2015
1 parent acbb312 commit cc41a48
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 17 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ find_package (Threads)

if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
find_package (procps)
if (procps_FOUND)
if (PROCPS_FOUND)
add_definitions (-DHAVE_READPROC_H)
endif ()
endif ()
Expand Down
21 changes: 7 additions & 14 deletions cmake/Findprocps.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,15 @@
#
# Once done this will define:
#
# procps_FOUND
# procps_INCLUDE_DIR
# procps_LIBRARY
# PROCPS_FOUND
# PROCPS_INCLUDE_DIR
# PROCPS_LIBRARY
#

include (FindPackageMessage)
include (FindPackageHandleStandardArgs)

if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
find_path (procps_INCLUDE_DIR proc/readproc.h)
find_library (procps_LIBRARY NAMES proc procps)
if (procps_INCLUDE_DIR AND procps_LIBRARY)
set (procps_FOUND 1)
mark_as_advanced (procps_FOUND)
find_package_message (procps "Found procps" "[${procps_LIBRARY}][${procps_INCLUDE_DIR}]")
else ()
find_package_message (procps "procps not found" "[${procps_LIBRARY}][${procps_INCLUDE_DIR}]")
endif ()
find_path (PROCPS_INCLUDE_DIR proc/readproc.h)
find_library (PROCPS_LIBRARY NAMES proc procps)
find_package_handle_standard_args (procps DEFAULT_MSG PROCPS_LIBRARY PROCPS_INCLUDE_DIR)
endif()

4 changes: 2 additions & 2 deletions retrace/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ add_dependencies (glretrace_common glproc)
target_link_libraries (glretrace_common
retrace_common
)
if (procps_FOUND)
target_link_libraries (glretrace_common ${procps_LIBRARY})
if (PROCPS_FOUND)
target_link_libraries (glretrace_common ${PROCPS_LIBRARY})
endif ()


Expand Down

0 comments on commit cc41a48

Please sign in to comment.