Use target_include_directories

This commit is contained in:
Matt McCormick 2018-04-14 09:47:35 -04:00
parent abe7290511
commit 3fad77c3ac

@ -16,10 +16,7 @@
# limitations under the License. # limitations under the License.
# #
cmake_minimum_required(VERSION 2.6) cmake_minimum_required(VERSION 3.5)
if(COMMAND cmake_policy)
cmake_policy(VERSION 2.6)
endif(COMMAND cmake_policy)
### General Package stuff ### General Package stuff
project(tmux-mem-cpu-load) project(tmux-mem-cpu-load)
@ -76,17 +73,17 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
elseif(CMAKE_SYSTEM_NAME MATCHES "NetBSD") elseif(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
set(METER_SOURCES "netbsd/memory.cc" "netbsd/cpu.cc" "common/load.cc") set(METER_SOURCES "netbsd/memory.cc" "netbsd/cpu.cc" "common/load.cc")
else() else()
message(FATAL_ERROR "${CMAKE_SYSTEM_NAME} Cannot be compiled on this system")
message(FATAL_ERROR "Cannot be compiled on this system") message(FATAL_ERROR "Cannot be compiled on this system")
endif() endif()
# set common source files # set common source files
set(COMMON_SOURCES "common/main.cc" "common/memory.cc" "common/graph.cc" "common/powerline.cc") set(COMMON_SOURCES "common/main.cc" "common/memory.cc" "common/graph.cc" "common/powerline.cc")
# add binary tree so we find version.h
include_directories("${PROJECT_BINARY_DIR}")
include_directories("${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/common")
add_executable(tmux-mem-cpu-load ${COMMON_SOURCES} ${METER_SOURCES}) add_executable(tmux-mem-cpu-load ${COMMON_SOURCES} ${METER_SOURCES})
# add binary tree so we find version.h
target_include_directories(tmux-mem-cpu-load "${PROJECT_BINARY_DIR}")
target_include_directories(tmux-mem-cpu-load "${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/common")
install(TARGETS tmux-mem-cpu-load RUNTIME DESTINATION bin) install(TARGETS tmux-mem-cpu-load RUNTIME DESTINATION bin)
include(CTest) include(CTest)