Fix cmake for Linux

This commit is contained in:

View File

@@ -23,26 +23,28 @@ else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -fPIC")
endif()
include_directories(experiments ${PIP_INCLUDES} can)
include_directories(experiments ${PIP_INCLUDES})
add_subdirectory(can)
if(WIN32)
include_directories(can)
add_custom_target(copy_dependencies
COMMAND ${CMAKE_COMMAND} -E copy ${PCAN_LIB} ${CMAKE_CURRENT_BINARY_DIR}/PCANBasic${CMAKE_SHARED_LIBRARY_SUFFIX}
COMMAND ${CMAKE_COMMAND} -E copy ${VSCAN_LIB} ${CMAKE_CURRENT_BINARY_DIR}/vs_can_api${CMAKE_SHARED_LIBRARY_SUFFIX})
add_subdirectory(can)
add_executable(can_send_multithread experiments/can_send_multithread.cpp)
target_link_libraries(can_send_multithread can)
add_dependencies(can_send_multithread copy_dependencies)
add_custom_target(copy_dependencies
COMMAND ${CMAKE_COMMAND} -E copy ${PCAN_LIB} ${CMAKE_CURRENT_BINARY_DIR}/PCANBasic${CMAKE_SHARED_LIBRARY_SUFFIX}
COMMAND ${CMAKE_COMMAND} -E copy ${VSCAN_LIB} ${CMAKE_CURRENT_BINARY_DIR}/vs_can_api${CMAKE_SHARED_LIBRARY_SUFFIX})
add_executable(can_send experiments/can_send.cpp)
target_link_libraries(can_send can)
add_dependencies(can_send copy_dependencies)
add_executable(can_send_multithread experiments/can_send_multithread.cpp)
target_link_libraries(can_send_multithread can)
add_dependencies(can_send_multithread copy_dependencies)
add_executable(can_send experiments/can_send.cpp)
target_link_libraries(can_send can)
add_dependencies(can_send copy_dependencies)
endif()
add_executable(mutex experiments/mutex.cpp)
target_link_libraries(mutex ${PIP_LIBRARY} ${PIP_CONCURRENT_LIBRARY})
add_dependencies(mutex copy_dependencies)
add_executable(mutex_multithread experiments/mutex_multithread.cpp)
target_link_libraries(mutex_multithread ${PIP_LIBRARY} ${PIP_CONCURRENT_LIBRARY})
add_dependencies(mutex_multithread copy_dependencies)
target_link_libraries(mutex_multithread ${PIP_LIBRARY} ${PIP_CONCURRENT_LIBRARY})