forked from Mizux/cmake-swig
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
28 lines (26 loc) · 856 Bytes
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
add_executable(FooBarApp "")
target_sources(FooBarApp
PRIVATE
src/main.cpp)
target_compile_features(FooBarApp PRIVATE cxx_std_17)
set_target_properties(FooBarApp PROPERTIES
VERSION ${PROJECT_VERSION})
# note: macOS is APPLE and also UNIX !
if(APPLE)
set_target_properties(FooBarApp PROPERTIES
INSTALL_RPATH "@loader_path/../${CMAKE_INSTALL_LIBDIR}")
elseif(UNIX AND NOT APPLE)
set_target_properties(FooBarApp PROPERTIES
INSTALL_RPATH "$ORIGIN/../${CMAKE_INSTALL_LIBDIR}")
endif()
target_link_libraries(FooBarApp PRIVATE ${PROJECT_NAMESPACE}::FooBar)
add_executable(${PROJECT_NAMESPACE}::FooBarApp ALIAS FooBarApp)
if(BUILD_TESTING)
add_test(NAME cpp_FooBarApp_test COMMAND FooBarApp)
endif()
# Install
include(GNUInstallDirs)
install(TARGETS FooBarApp
EXPORT ${PROJECT_NAME}Targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)