Commit 9bda55ed authored by Ma Bingyao's avatar Ma Bingyao

Update CmakeLists.txt

parent 213a09e7
...@@ -4,6 +4,7 @@ set(CMAKE_MACOSX_RPATH 1) ...@@ -4,6 +4,7 @@ set(CMAKE_MACOSX_RPATH 1)
set(LIBXXTEA_SRC xxtea.c) set(LIBXXTEA_SRC xxtea.c)
add_library(xxtea SHARED ${LIBXXTEA_SRC}) add_library(xxtea SHARED ${LIBXXTEA_SRC})
add_library(xxtea_static STATIC ${LIBXXTEA_SRC}) add_library(xxtea_static STATIC ${LIBXXTEA_SRC})
set_target_properties(xxtea PROPERTIES VERSION 1.0 SOVERSION 1)
set_target_properties(xxtea_static PROPERTIES OUTPUT_NAME "xxtea") set_target_properties(xxtea_static PROPERTIES OUTPUT_NAME "xxtea")
set_target_properties(xxtea PROPERTIES CLEAN_DIRECT_OUTPUT 1) set_target_properties(xxtea PROPERTIES CLEAN_DIRECT_OUTPUT 1)
set_target_properties(xxtea_static PROPERTIES CLEAN_DIRECT_OUTPUT 1) set_target_properties(xxtea_static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
......
...@@ -5,7 +5,13 @@ add_executable(main ${DIR_SRCS}) ...@@ -5,7 +5,13 @@ add_executable(main ${DIR_SRCS})
find_path(LIBXXTEA_HEADER xxtea.h) find_path(LIBXXTEA_HEADER xxtea.h)
include_directories(${LIBXXTEA_HEADER}) include_directories(${LIBXXTEA_HEADER})
find_library( find_library(
LIBXXTEA_LIBRARIES NAMES xxtea LIBXXTEA_STATIC_LIBRARIES NAMES libxxtea.a
PATHS /usr/lib/ /usr/local/lib/
) )
target_link_libraries(main ${LIBXXTEA_LIBRARIES}) if(LIBXXTEA_STATIC_LIBRARIES)
target_link_libraries(main ${LIBXXTEA_STATIC_LIBRARIES})
else(LIBXXTEA_STATIC_LIBRARIES)
find_library(
LIBXXTEA_LIBRARIES NAMES xxtea
)
target_link_libraries(main ${LIBXXTEA_LIBRARIES})
endif(LIBXXTEA_STATIC_LIBRARIES)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment