summaryrefslogtreecommitdiff
path: root/cmake/MacroAddDLL.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/MacroAddDLL.cmake')
-rw-r--r--cmake/MacroAddDLL.cmake20
1 files changed, 20 insertions, 0 deletions
diff --git a/cmake/MacroAddDLL.cmake b/cmake/MacroAddDLL.cmake
new file mode 100644
index 0000000..deabb73
--- /dev/null
+++ b/cmake/MacroAddDLL.cmake
@@ -0,0 +1,20 @@
+# Adds flag to compiler if it supports it
+
+macro (ADD_DLL _name _dir)
+ if (WIN32)
+ string (TOUPPER "${_name}" FLAGNAME)
+ string (REPLACE " " "_" FLAGNAME "${FLAGNAME}")
+ string (REPLACE "-" "_" FLAGNAME "${FLAGNAME}")
+ string (REPLACE "=" "_" FLAGNAME "${FLAGNAME}")
+ string (REPLACE "," "_" FLAGNAME "${FLAGNAME}")
+ set (FLAGNAME "DLL_${FLAGNAME}")
+
+ string(REGEX REPLACE "/[^/]*$" "" TMP_LIB_DIR "${_dir}")
+ find_file(${FLAGNAME} "${_name}" "${TMP_LIB_DIR}/../bin/" "${TMP_LIB_DIR}") # DOC "Path to ${_name} library")
+ list(APPEND WIN32_INSTALL_DLL "${${FLAGNAME}}")
+ CONFIGURE_FILE("${${FLAGNAME}}" "${CMAKE_CURRENT_BINARY_DIR}/gammu/${_name}" COPYONLY)
+ CONFIGURE_FILE("${${FLAGNAME}}" "${CMAKE_CURRENT_BINARY_DIR}/gammu-detect/${_name}" COPYONLY)
+ CONFIGURE_FILE("${${FLAGNAME}}" "${CMAKE_CURRENT_BINARY_DIR}/tests/${_name}" COPYONLY)
+ CONFIGURE_FILE("${${FLAGNAME}}" "${CMAKE_CURRENT_BINARY_DIR}/smsd/${_name}" COPYONLY)
+ endif (WIN32)
+endmacro (ADD_DLL _name _dir)