Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix paths to test binaries #112

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions examples/c/proactor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ add_definitions(${COMPILE_LANGUAGE_FLAGS} ${COMPILE_WARNING_FLAGS} ${WERROR} ${C

# Add a test with the correct environment to find test executables and valgrind.
if(WIN32)
set(test_path "$<TARGET_FILE_DIR:broker>;$<TARGET_FILE_DIR:qpid-proton>")
set(test_path "${CMAKE_RUNTIME_OUTPUT_DIRECTORY};$<TARGET_FILE_DIR:broker>;$<TARGET_FILE_DIR:qpid-proton>")
else(WIN32)
set(test_path "${CMAKE_CURRENT_BINARY_DIR}:$ENV{PATH}")
set(test_path "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}:$ENV{PATH}")
endif(WIN32)

foreach(name broker send receive direct)
Expand All @@ -41,4 +41,5 @@ endforeach()

set(run_env ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/proton-c/env.py ${EXAMPLE_ENV} "PATH=${test_path}" ${VALGRIND_ENV})

add_test(c-example-proactor ${run_env} -- ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/example_test.py -v)
add_test(NAME c-example-proactor COMMAND ${run_env} -- ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/example_test.py -v)
#WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
5 changes: 3 additions & 2 deletions examples/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ add_definitions(${CXX_WARNING_FLAGS})
# Add a test with the correct environment to find test executables and valgrind.
macro(add_cpp_test name)
if(WIN32)
set(test_path "$<TARGET_FILE_DIR:broker>;$<TARGET_FILE_DIR:qpid-proton>;$<TARGET_FILE_DIR:qpid-proton-cpp>")
set(test_path "${CMAKE_RUNTIME_OUTPUT_DIRECTORY};$<TARGET_FILE_DIR:broker>;$<TARGET_FILE_DIR:qpid-proton>;$<TARGET_FILE_DIR:qpid-proton-cpp>")
else(WIN32)
set(test_path "$<TARGET_FILE_DIR:broker>:$ENV{PATH}")
set(test_path "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}:$ENV{PATH}")
endif(WIN32)
set(run_env ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/proton-c/env.py ${EXAMPLE_ENV})
add_test(NAME ${name} COMMAND ${run_env} "PATH=${test_path}" ${VALGRIND_ENV} -- ${ARGN})
#WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
endmacro()

# Single-threaded examples that work on C++03
Expand Down
6 changes: 5 additions & 1 deletion proton-c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -640,10 +640,14 @@ if (qpid-proton-proactor)
)
endif()

if (NOT BIN_INSTALL_DIR)
set(BIN_INSTALL_DIR "bin")
endif(NOT BIN_INSTALL_DIR)

# Install executables and libraries
install(TARGETS qpid-proton qpid-proton-core ${LIB_TARGETS}
EXPORT proton
RUNTIME DESTINATION bin
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
LIBRARY DESTINATION ${LIB_INSTALL_DIR})

Expand Down
19 changes: 13 additions & 6 deletions proton-c/bindings/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,13 @@ set_target_properties (
)

## Install
if (NOT BIN_INSTALL_DIR)
set(BIN_INSTALL_DIR "bin")
endif(NOT BIN_INSTALL_DIR)

install(TARGETS qpid-proton-cpp
EXPORT proton-cpp
RUNTIME DESTINATION bin
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
LIBRARY DESTINATION ${LIB_INSTALL_DIR})

Expand All @@ -132,11 +135,11 @@ install (FILES
DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)

if (DEFINED CMAKE_IMPORT_LIBRARY_PREFIX)
set(PROTONCPPLIB ${CMAKE_IMPORT_LIBRARY_PREFIX}qpid-proton-cpp${CMAKE_IMPORT_LIBRARY_SUFFIX})
set(PROTONCPPLIBDEBUG ${CMAKE_IMPORT_LIBRARY_PREFIX}qpid-proton-cpp${CMAKE_DEBUG_POSTFIX}${CMAKE_IMPORT_LIBRARY_SUFFIX})
set(PROTONCPPLIB ${CMAKE_IMPORT_LIBRARY_PREFIX}qpid-proton-cpp${CMAKE_IMPORT_LIBRARY_SUFFIX})
set(PROTONCPPLIBDEBUG ${CMAKE_IMPORT_LIBRARY_PREFIX}qpid-proton-cpp${CMAKE_DEBUG_POSTFIX}${CMAKE_IMPORT_LIBRARY_SUFFIX})
else ()
set(PROTONCPPLIB ${CMAKE_SHARED_LIBRARY_PREFIX}qpid-proton-cpp${CMAKE_SHARED_LIBRARY_SUFFIX})
set(PROTONCPPLIBDEBUG ${CMAKE_SHARED_LIBRARY_PREFIX}qpid-proton-cpp${CMAKE_DEBUG_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX})
set(PROTONCPPLIB ${CMAKE_SHARED_LIBRARY_PREFIX}qpid-proton-cpp${CMAKE_SHARED_LIBRARY_SUFFIX})
set(PROTONCPPLIBDEBUG ${CMAKE_SHARED_LIBRARY_PREFIX}qpid-proton-cpp${CMAKE_DEBUG_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX})
endif ()

include(WriteBasicConfigVersionFile)
Expand All @@ -158,6 +161,10 @@ if (ENABLE_VALGRIND AND VALGRIND_EXE)
set(memcheck-cmd ${VALGRIND_EXE} --error-exitcode=42 --quiet --leak-check=full --trace-children=yes)
endif ()

if (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)

macro(add_cpp_test test)
add_executable (${test} src/${test}.cpp)
target_link_libraries (${test} qpid-proton qpid-proton-cpp)
Expand All @@ -167,7 +174,7 @@ macro(add_cpp_test test)
"PATH=$<TARGET_FILE_DIR:qpid-proton>"
$<TARGET_FILE:${test}> ${ARGN})
else ()
add_test (NAME cpp-${test} COMMAND ${memcheck-cmd} ${CMAKE_CURRENT_BINARY_DIR}/${test} ${ARGN})
add_test (NAME cpp-${test} COMMAND ${memcheck-cmd} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${test} ${ARGN})
endif ()
endmacro(add_cpp_test)

Expand Down
14 changes: 10 additions & 4 deletions proton-c/src/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ if (ENABLE_VALGRIND AND VALGRIND_EXE)
--suppressions=${CMAKE_CURRENT_SOURCE_DIR}/valgrind.supp)
endif ()

if (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)

macro (pn_add_c_test test)
add_executable (${test} ${ARGN})
target_link_libraries (${test} qpid-proton ${PLATFORM_LIBS})
Expand All @@ -40,7 +44,7 @@ macro (pn_add_c_test test)
"PATH=$<TARGET_FILE_DIR:qpid-proton>"
$<TARGET_FILE:${test}>)
else ()
add_test (${test} ${memcheck-cmd} ${CMAKE_CURRENT_BINARY_DIR}/${test})
add_test (${test} ${memcheck-cmd} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${test})
endif ()
endmacro(pn_add_c_test)

Expand All @@ -65,11 +69,13 @@ if(HAS_PROACTOR)
if(WIN32)
# set(path "$<TARGET_FILE_DIR:proactor-broker>;$<TARGET_FILE_DIR:qpid-proton>")
else(WIN32)
set(path "${CMAKE_CURRENT_BINARY_DIR}:${CMAKE_BINARY_DIR}/examples/c/proactor:$ENV{PATH}")
set(test_path "${CMAKE_CURRENT_BINARY_DIR}:$<TARGET_FILE_DIR:proactor-broker>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}:$ENV{PATH}")
endif(WIN32)
# Add the tools directory for the 'proctest' module
set_search_path(pypath "${CMAKE_SOURCE_DIR}/tools/py" "$ENV{PYTHON_PATH}")

add_test(NAME c-fdlimit-tests COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/fdlimit.py)
set_tests_properties(c-fdlimit-tests PROPERTIES ENVIRONMENT "PATH=${path};PYTHONPATH=${pypath}")
set(run_env ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/proton-c/env.py "PATH=${test_path}" "PYTHONPATH=${pypath}")
add_test(NAME c-fdlimit-tests COMMAND ${run_env} -- ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/fdlimit.py)
#WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
set_tests_properties(c-fdlimit-tests PROPERTIES ENVIRONMENT "PATH=${test_path};PYTHONPATH=${pypath}")
endif(HAS_PROACTOR)