forked from cgreen-devs/cgreen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix cgreen-devs#251: cgreen-runner handle non-lib files
Remove dependency to nm and rather use libbfd, which is the same lib used by nm. There is no additional depency, but cmake will fail if it cannot find libbfd. There was no check for nm before. Unit test still use nm to count the number of symbols. It provides a double check on this implementation. Before we would get: $ ./build/tools/cgreen-runner ./build/tests/libbreadcrumb_tests.so Running "libbreadcrumb_tests" (9 tests)... "Breadcrumb": 9 passes in 3ms. Completed "libbreadcrumb_tests": 9 passes in 3ms. $ ./build/tools/cgreen-runner ./build/tests/Makefile /usr/bin/nm: ./build/tests/Makefile: file format not recognized No tests found in './build/tests/Makefile'. $ ./build/tools/cgreen-runner /usr/lib/libgit2.so /usr/bin/nm: /usr/lib/libgit2.so: no symbols No tests found in '/usr/lib/libgit2.so'. After this patch we get: $ ./build/tools/cgreen-runner ./build/tests/libbreadcrumb_tests.so Running "libbreadcrumb_tests" (9 tests)... "Breadcrumb": 9 passes in 3ms. Completed "libbreadcrumb_tests": 9 passes in 3ms. $ ./build/tools/cgreen-runner ./build/tests/Makefile No tests found in './build/tests/Makefile'. $ ./build/tools/cgreen-runner /usr/lib/libgit2.so No tests found in '/usr/lib/libgit2.so'.
- Loading branch information
Showing
3 changed files
with
134 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# - Try to find libbfd | ||
# Once done this will define | ||
# | ||
# LIBBFD_FOUND - system has libbfd | ||
# LIBBFD_INCLUDE_DIRS - the libbfd include directory | ||
# LIBBFD_LIBRARIES - Link these to use libbfd | ||
# LIBBFD_DEFINITIONS - Compiler switches required for using libbfd | ||
# | ||
# Based on: | ||
# | ||
# Copyright (c) 2008 Bernhard Walle <bernhard.walle@gmx.de> | ||
# | ||
# Redistribution and use is allowed according to the terms of the New | ||
# BSD license. | ||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file. | ||
# | ||
|
||
|
||
if (LIBBFD_LIBRARIES AND LIBBFD_INCLUDE_DIRS) | ||
set (LIBBFD_FIND_QUIETLY TRUE) | ||
endif () | ||
|
||
find_path (LIBBFD_INCLUDE_DIRS | ||
NAMES | ||
bfd.h | ||
dis-asm.h | ||
PATHS | ||
/usr/include | ||
/usr/local/include | ||
/opt/local/include | ||
/opt/include | ||
ENV CPATH) | ||
|
||
# Ugly, yes ugly... | ||
find_library (LIBBFD_BFD_LIBRARY | ||
NAMES | ||
bfd | ||
PATHS | ||
/usr/lib | ||
/usr/lib64 | ||
/usr/local/lib | ||
/usr/local/lib64 | ||
/usr/include | ||
/opt/local/lib | ||
/opt/usr/lib64 | ||
ENV LIBRARY_PATH | ||
ENV LD_LIBRARY_PATH) | ||
|
||
include (FindPackageHandleStandardArgs) | ||
|
||
|
||
# handle the QUIETLY and REQUIRED arguments and set LIBBFD_FOUND to TRUE if all listed variables are TRUE | ||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibBfd DEFAULT_MSG | ||
LIBBFD_BFD_LIBRARY | ||
LIBBFD_INCLUDE_DIRS) | ||
|
||
set(LIBBFD_LIBRARIES "${LIBBFD_BFD_LIBRARY}") | ||
mark_as_advanced(LIBBFD_INCLUDE_DIRS LIBBFD_LIBRARIES LIBBFD_BFD_LIBRARY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters