From 263f88b0902b8c7d7f5582cec060a1606afb3ee6 Mon Sep 17 00:00:00 2001 From: mutouyun Date: Tue, 1 Jan 2019 16:26:22 +0800 Subject: [PATCH] cmake --- .travis.yml | 4 +--- build/ipc/CMakeLists.txt | 6 +++--- build/test/CMakeLists.txt | 8 +++++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index f8179eb..4873df7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,8 +8,7 @@ addons: - ubuntu-toolchain-r-test packages: - g++-7 - - qt5-qmake - - libqt5test5 + - qtbase5-dev matrix: include: @@ -23,7 +22,6 @@ matrix: before_install: - eval "${MATRIX_EVAL}" - - find /usr/ -name "Qt5CoreConfig.cmake" - qmake -v script: diff --git a/build/ipc/CMakeLists.txt b/build/ipc/CMakeLists.txt index 52c88e9..7f75256 100644 --- a/build/ipc/CMakeLists.txt +++ b/build/ipc/CMakeLists.txt @@ -1,6 +1,6 @@ project(ipc) -add_compile_definitions(__IPC_LIBRARY__) +add_compile_options(-D__IPC_LIBRARY__) include_directories(../../include ../../src) @@ -11,5 +11,5 @@ else() endif() aux_source_directory(../../src DIR_SRCS) -add_library(ipc SHARED ${DIR_SRCS}) -set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/../output) \ No newline at end of file +add_library(${PROJECT_NAME} SHARED ${DIR_SRCS}) +set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/../output) diff --git a/build/test/CMakeLists.txt b/build/test/CMakeLists.txt index 7b64103..ed91661 100644 --- a/build/test/CMakeLists.txt +++ b/build/test/CMakeLists.txt @@ -1,8 +1,7 @@ -project(test) +project(test-ipc) set(CMAKE_AUTOMOC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) -set(CMAKE_PREFIX_PATH /usr/include/qt5) find_package(Qt5 COMPONENTS Core Test REQUIRED) @@ -19,4 +18,7 @@ link_directories(${EXECUTABLE_OUTPUT_PATH}) add_subdirectory(../ipc ipc.out) add_executable(${PROJECT_NAME} ${SRC_FILES} ${HEAD_FILES}) -target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Test ipc) \ No newline at end of file +target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Test ipc) +if(NOT MSVC) + target_link_libraries(${PROJECT_NAME} pthread rt) +endif()