File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed
Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -111,8 +111,20 @@ add_executable(testCompressedStream test/TestCompressedStream.cpp)
111111target_link_libraries (testCompressedStream libkanzi)
112112
113113# Main executable
114+
115+ # Dynamically linked executable
114116add_executable (kanzi ${APP_SOURCES} )
115- target_link_libraries (kanzi libkanzi)
117+ target_link_libraries (kanzi libkanzi_shared)
118+
119+ # Set RPATH for Linux so it finds libkanzi.so at runtime
120+ set_target_properties (kanzi PROPERTIES
121+ BUILD_WITH_INSTALL_RPATH TRUE
122+ INSTALL_RPATH "$ORIGIN/../lib"
123+ )
124+
125+ # Statically linked executable
126+ add_executable (kanzi_static ${APP_SOURCES} )
127+ target_link_libraries (kanzi_static libkanzi)
116128
117129# Custom target to build all tests
118130add_custom_target (test
@@ -133,7 +145,12 @@ add_custom_target(lib
133145 DEPENDS static_lib shared_lib
134146)
135147
136- # Install the main executable
148+ # Install the statically linked executable
149+ install (TARGETS kanzi_static
150+ RUNTIME DESTINATION bin
151+ )
152+
153+ # Install dynamically linked executable
137154install (TARGETS kanzi
138155 RUNTIME DESTINATION bin
139156)
You can’t perform that action at this time.
0 commit comments