动态库的cmake
cmake_minimum_required(VERSION 2.8)
project(app)
#指定生成的版本
set(CMAKE_BUILD_TYPE DEBUG)
# 例程:cmake .. -DCURRENT_COMPILER=ARM
if(CURRENT_COMPILER MATCHES ARM)
# C 编译器
set(CMAKE_C_COMPILER "arm-linux-uclibcgnueabi-gcc")
# C++ 编译器
set(CMAKE_CXX_COMPILER "arm-linux-uclibcgnueabi-g++")
endif()
message( STATUS "C_COMPILER = ${CMAKE_C_COMPILER}.")
message( STATUS "CXX_COMPILER = ${CMAKE_CXX_COMPILER}.")
# C99 编译
set(CMAKE_C_FLAGS "-std=gnu99 -fvisibility=hidden")
#指定编译选项
set(CMAKE_C_FLAGS_DEBUG "-g -Wall")
#工程源文件
#set(SOURCE_FILES param.c param.h)
aux_source_directory(. all_source)
# 打印 CMAKE_CURRENT_SOURCE_DIR
#MESSAGE( STATUS "CurrDir = ${all_source}.")
#创建共享库
add_library(app SHARED ${all_source})