Permalink
Browse files

More flexible add_simple library

  • Loading branch information...
1 parent 6bb13fb commit 711ccb88b084ac6e0079132b9c26987d1c87366c @alekseysidorov committed May 3, 2012
Showing with 14 additions and 3 deletions.
  1. +14 −3 CommonUtils.cmake
View
17 CommonUtils.cmake
@@ -61,10 +61,18 @@ macro(UPDATE_COMPILER_FLAGS target)
set_target_properties(${target} PROPERTIES COMPILE_FLAGS "${COMPILER_FLAGS}")
endmacro()
-macro(ADD_SIMPLE_LIBRARY target type)
- if(NOT DEFINED type)
+macro(ADD_SIMPLE_LIBRARY target)
+ parse_arguments(LIBRARY
+ "LIBRARIES;INCLUDES;DEFINES"
+ "STATIC"
+ ${ARGN}
+ )
+ if(LIBRARY_STATIC)
set(type STATIC)
+ else()
+ set(type SHARED)
endif()
+
message(STATUS "Searching ${target} source and headers")
#Search for source and headers in source directory
@@ -82,9 +90,12 @@ macro(ADD_SIMPLE_LIBRARY target type)
# This project will generate library
add_library(${target} ${type} ${SRC} ${MM} ${HDR} ${UIS_H} ${MOC_SRCS} ${QRC_SOURCES})
+ foreach(_define ${LIBRARY_DEFINES})
+ add_definitions(-D${_define})
+ endforeach()
include_directories(${CMAKE_CURRENT_BINARY_DIR}
-
+ .
)
update_compiler_flags(${target})

0 comments on commit 711ccb8

Please sign in to comment.