-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[build][runner] Add option to build (or not) runner (CGREEN_BUILD_RUN…
…NER)
- Loading branch information
Showing
2 changed files
with
41 additions
and
38 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
option(CGREEN_WITH_STATIC_LIBRARY "Build with a static library" OFF) | ||
option(CGREEN_WITH_UNIT_TESTS "Build unit tests" ON) | ||
option(CGREEN_BUILD_RUNNER "Build auto-discovering cgreen-runner using libbfd" ON) | ||
option(CGREEN_INTERNAL_WITH_GCOV "Build with test coverage instrumentation" OFF) | ||
mark_as_advanced(CGREEN_INTERNAL_WITH_GCOV) |
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 |
---|---|---|
@@ -1,46 +1,48 @@ | ||
find_package(LibBfd) | ||
if(CGREEN_BUILD_RUNNER) | ||
find_package(LibBfd) | ||
|
||
if(LibBfd_FOUND) | ||
include_directories(${CGREEN_PUBLIC_INCLUDE_DIRS} ${PROJECT_BINARY_DIR} ${LIBBFD_INCLUDE_DIRS}) | ||
if(LibBfd_FOUND) | ||
include_directories(${CGREEN_PUBLIC_INCLUDE_DIRS} ${PROJECT_BINARY_DIR} ${LIBBFD_INCLUDE_DIRS}) | ||
|
||
# Need to explicitly add libintl - Cygwin issue with binutils-2.37-2 | ||
if (CYGWIN) | ||
find_library(EXPLICIT_INTLIB_ONLY_REQUIRED_FOR_CYGWIN NAMES intl libintl) | ||
else () | ||
set(EXPLICIT_INTLIB_ONLY_REQUIRED_FOR_CYGWIN "") | ||
endif() | ||
# Need to explicitly add libintl - Cygwin issue with binutils-2.37-2 | ||
if (CYGWIN) | ||
find_library(EXPLICIT_INTLIB_ONLY_REQUIRED_FOR_CYGWIN NAMES intl libintl) | ||
else () | ||
set(EXPLICIT_INTLIB_ONLY_REQUIRED_FOR_CYGWIN "") | ||
endif() | ||
|
||
set(RUNNER_SRCS | ||
${CMAKE_CURRENT_SOURCE_DIR}/cgreen-runner.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/gopt.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/gopt-errors.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/runner.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/discoverer.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/test_item.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/bfd_adapter.c | ||
) | ||
set_source_files_properties(${RUNNER_SRCS} PROPERTIES LANGUAGE C) | ||
set(RUNNER_SRCS | ||
${CMAKE_CURRENT_SOURCE_DIR}/cgreen-runner.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/gopt.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/gopt-errors.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/runner.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/discoverer.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/test_item.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/bfd_adapter.c | ||
) | ||
set_source_files_properties(${RUNNER_SRCS} PROPERTIES LANGUAGE C) | ||
|
||
include(DefineRelativeFilePaths) | ||
cmake_define_relative_file_paths ("${RUNNER_SRCS}") | ||
include(DefineRelativeFilePaths) | ||
cmake_define_relative_file_paths ("${RUNNER_SRCS}") | ||
|
||
add_executable(cgreen-runner ${RUNNER_SRCS}) | ||
target_link_libraries(cgreen-runner PRIVATE | ||
${CGREEN_LIBRARY} | ||
${CMAKE_DL_LIBS} | ||
${LIBBFD_LIBRARIES} | ||
${EXPLICIT_INTLIB_ONLY_REQUIRED_FOR_CYGWIN} | ||
) | ||
add_executable(cgreen-runner ${RUNNER_SRCS}) | ||
target_link_libraries(cgreen-runner PRIVATE | ||
${CGREEN_LIBRARY} | ||
${CMAKE_DL_LIBS} | ||
${LIBBFD_LIBRARIES} | ||
${EXPLICIT_INTLIB_ONLY_REQUIRED_FOR_CYGWIN} | ||
) | ||
|
||
install(TARGETS cgreen-runner | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
) | ||
install(TARGETS cgreen-runner | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
) | ||
|
||
install(PROGRAMS cgreen-debug | ||
DESTINATION ${CMAKE_INSTALL_BINDIR}) | ||
else() | ||
message(WARNING "libbfd not found, cgreen-runner will not be built") | ||
install(PROGRAMS cgreen-debug | ||
DESTINATION ${CMAKE_INSTALL_BINDIR}) | ||
else() | ||
message(WARNING "libbfd not found, cgreen-runner will not be built") | ||
endif() | ||
endif() |