Clean up *.cmake style

develop
lethosor 2019-07-20 16:16:25 -04:00
parent 8a07426643
commit ab9ad6f93e
3 changed files with 214 additions and 214 deletions

@ -1,71 +1,71 @@
# Helper to download files as needed # Helper to download files as needed
function(file_md5_if_exists FILE VAR) function(file_md5_if_exists FILE VAR)
if(EXISTS "${FILE}") if(EXISTS "${FILE}")
file(MD5 "${FILE}" "${VAR}") file(MD5 "${FILE}" "${VAR}")
set(${VAR} "${${VAR}}" PARENT_SCOPE) set(${VAR} "${${VAR}}" PARENT_SCOPE)
else() else()
set(${VAR} "" PARENT_SCOPE) set(${VAR} "" PARENT_SCOPE)
endif() endif()
endfunction() endfunction()
function(search_downloads FILE_MD5 VAR) function(search_downloads FILE_MD5 VAR)
set(${VAR} "" PARENT_SCOPE) set(${VAR} "" PARENT_SCOPE)
file(GLOB FILES ${CMAKE_SOURCE_DIR}/CMake/downloads/*) file(GLOB FILES ${CMAKE_SOURCE_DIR}/CMake/downloads/*)
foreach(FILE ${FILES}) foreach(FILE ${FILES})
file(MD5 "${FILE}" CUR_MD5) file(MD5 "${FILE}" CUR_MD5)
if("${CUR_MD5}" STREQUAL "${FILE_MD5}") if("${CUR_MD5}" STREQUAL "${FILE_MD5}")
set(${VAR} ${FILE} PARENT_SCOPE) set(${VAR} ${FILE} PARENT_SCOPE)
return() return()
endif() endif()
endforeach() endforeach()
endfunction() endfunction()
function(download_file URL DEST EXPECTED_MD5) function(download_file URL DEST EXPECTED_MD5)
get_filename_component(FILENAME "${URL}" NAME) get_filename_component(FILENAME "${URL}" NAME)
file_md5_if_exists("${DEST}" CUR_MD5) file_md5_if_exists("${DEST}" CUR_MD5)
if(NOT "${EXPECTED_MD5}" STREQUAL "${CUR_MD5}") if(NOT "${EXPECTED_MD5}" STREQUAL "${CUR_MD5}")
search_downloads(${EXPECTED_MD5} DLPATH) search_downloads(${EXPECTED_MD5} DLPATH)
if(NOT("${DLPATH}" STREQUAL "")) if(NOT("${DLPATH}" STREQUAL ""))
message("* Copying ${FILENAME} from ${DLPATH}") message("* Copying ${FILENAME} from ${DLPATH}")
execute_process(COMMAND "${CMAKE_COMMAND}" -E copy execute_process(COMMAND "${CMAKE_COMMAND}" -E copy
"${DLPATH}" "${DLPATH}"
"${DEST}") "${DEST}")
return() return()
endif() endif()
message("* Downloading ${FILENAME}") message("* Downloading ${FILENAME}")
file(DOWNLOAD "${URL}" "${DEST}" EXPECTED_MD5 "${EXPECTED_MD5}" SHOW_PROGRESS) file(DOWNLOAD "${URL}" "${DEST}" EXPECTED_MD5 "${EXPECTED_MD5}" SHOW_PROGRESS)
endif() endif()
endfunction() endfunction()
# Download a file and uncompress it # Download a file and uncompress it
function(download_file_unzip URL ZIP_TYPE ZIP_DEST ZIP_MD5 UNZIP_DEST UNZIP_MD5) function(download_file_unzip URL ZIP_TYPE ZIP_DEST ZIP_MD5 UNZIP_DEST UNZIP_MD5)
get_filename_component(FILENAME "${URL}" NAME) get_filename_component(FILENAME "${URL}" NAME)
file_md5_if_exists("${UNZIP_DEST}" CUR_UNZIP_MD5) file_md5_if_exists("${UNZIP_DEST}" CUR_UNZIP_MD5)
# Redownload if the MD5 of the uncompressed file doesn't match # Redownload if the MD5 of the uncompressed file doesn't match
if(NOT "${UNZIP_MD5}" STREQUAL "${CUR_UNZIP_MD5}") if(NOT "${UNZIP_MD5}" STREQUAL "${CUR_UNZIP_MD5}")
download_file("${URL}" "${ZIP_DEST}" "${ZIP_MD5}") download_file("${URL}" "${ZIP_DEST}" "${ZIP_MD5}")
if(EXISTS "${ZIP_DEST}") if(EXISTS "${ZIP_DEST}")
message("* Decompressing ${FILENAME}") message("* Decompressing ${FILENAME}")
if("${ZIP_TYPE}" STREQUAL "gz") if("${ZIP_TYPE}" STREQUAL "gz")
execute_process(COMMAND execute_process(COMMAND
"${PERL_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/depends/gunzip.pl" "${PERL_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/depends/gunzip.pl"
"${ZIP_DEST}" --force) "${ZIP_DEST}" --force)
else() else()
message(SEND_ERROR "Unknown ZIP_TYPE: ${ZIP_TYPE}") message(SEND_ERROR "Unknown ZIP_TYPE: ${ZIP_TYPE}")
endif() endif()
if(NOT EXISTS "${UNZIP_DEST}") if(NOT EXISTS "${UNZIP_DEST}")
message(SEND_ERROR "File failed to unzip to ${UNZIP_DEST}") message(SEND_ERROR "File failed to unzip to ${UNZIP_DEST}")
else() else()
file(MD5 "${UNZIP_DEST}" CUR_UNZIP_MD5) file(MD5 "${UNZIP_DEST}" CUR_UNZIP_MD5)
if(NOT "${UNZIP_MD5}" STREQUAL "${CUR_UNZIP_MD5}") if(NOT "${UNZIP_MD5}" STREQUAL "${CUR_UNZIP_MD5}")
message(SEND_ERROR "MD5 mismatch: ${UNZIP_DEST}: expected ${UNZIP_MD5}, got ${CUR_UNZIP_MD5}") message(SEND_ERROR "MD5 mismatch: ${UNZIP_DEST}: expected ${UNZIP_MD5}, got ${CUR_UNZIP_MD5}")
endif()
endif()
endif() endif()
endif()
endif() endif()
endif()
endfunction() endfunction()

@ -32,11 +32,11 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
################################################################################################## ##################################################################################################
# #
# CMake script for finding TinyXML. # CMake script for finding TinyXML.
# #
# Input variables: # Input variables:
# #
# - TinyXML_ROOT_DIR (optional): When specified, header files and libraries will be searched for in # - TinyXML_ROOT_DIR (optional): When specified, header files and libraries will be searched for in
# ${TinyXML_ROOT_DIR}/include # ${TinyXML_ROOT_DIR}/include
# ${TinyXML_ROOT_DIR}/libs # ${TinyXML_ROOT_DIR}/libs
@ -46,23 +46,23 @@
# preference is given to the CMake variable. # preference is given to the CMake variable.
# Use this variable for finding packages installed in a nonstandard location, or for enforcing # Use this variable for finding packages installed in a nonstandard location, or for enforcing
# that one of multiple package installations is picked up. # that one of multiple package installations is picked up.
# #
# #
# Cache variables (not intended to be used in CMakeLists.txt files) # Cache variables (not intended to be used in CMakeLists.txt files)
# #
# - TinyXML_INCLUDE_DIR: Absolute path to package headers. # - TinyXML_INCLUDE_DIR: Absolute path to package headers.
# - TinyXML_LIBRARY: Absolute path to library. # - TinyXML_LIBRARY: Absolute path to library.
# #
# #
# Output variables: # Output variables:
# #
# - TinyXML_FOUND: Boolean that indicates if the package was found # - TinyXML_FOUND: Boolean that indicates if the package was found
# - TinyXML_INCLUDE_DIRS: Paths to the necessary header files # - TinyXML_INCLUDE_DIRS: Paths to the necessary header files
# - TinyXML_LIBRARIES: Package libraries # - TinyXML_LIBRARIES: Package libraries
# #
# #
# Example usage: # Example usage:
# #
# find_package(TinyXML) # find_package(TinyXML)
# if(NOT TinyXML_FOUND) # if(NOT TinyXML_FOUND)
# # Error handling # # Error handling
@ -71,19 +71,19 @@
# include_directories(${TinyXML_INCLUDE_DIRS} ...) # include_directories(${TinyXML_INCLUDE_DIRS} ...)
# ... # ...
# target_link_libraries(my_target ${TinyXML_LIBRARIES}) # target_link_libraries(my_target ${TinyXML_LIBRARIES})
# #
################################################################################################## ##################################################################################################
# Get package location hint from environment variable (if any) # Get package location hint from environment variable (if any)
if(NOT TinyXML_ROOT_DIR AND DEFINED ENV{TinyXML_ROOT_DIR}) if(NOT TinyXML_ROOT_DIR AND DEFINED ENV{TinyXML_ROOT_DIR})
set(TinyXML_ROOT_DIR "$ENV{TinyXML_ROOT_DIR}" CACHE PATH set(TinyXML_ROOT_DIR "$ENV{TinyXML_ROOT_DIR}" CACHE PATH
"TinyXML base directory location (optional, used for nonstandard installation paths)") "TinyXML base directory location (optional, used for nonstandard installation paths)")
endif() endif()
# Search path for nonstandard package locations # Search path for nonstandard package locations
if(TinyXML_ROOT_DIR) if(TinyXML_ROOT_DIR)
set(TinyXML_INCLUDE_PATH PATHS "${TinyXML_ROOT_DIR}/include" NO_DEFAULT_PATH) set(TinyXML_INCLUDE_PATH PATHS "${TinyXML_ROOT_DIR}/include" NO_DEFAULT_PATH)
set(TinyXML_LIBRARY_PATH PATHS "${TinyXML_ROOT_DIR}/lib" NO_DEFAULT_PATH) set(TinyXML_LIBRARY_PATH PATHS "${TinyXML_ROOT_DIR}/lib" NO_DEFAULT_PATH)
endif() endif()
# Find headers and libraries # Find headers and libraries
@ -102,6 +102,6 @@ set(TinyXML_FOUND ${TINYXML_FOUND}) # Enforce case-correctness: Set appropriatel
unset(TINYXML_FOUND) # ...and unset uppercase variable generated by find_package_handle_standard_args unset(TINYXML_FOUND) # ...and unset uppercase variable generated by find_package_handle_standard_args
if(TinyXML_FOUND) if(TinyXML_FOUND)
set(TinyXML_INCLUDE_DIRS ${TinyXML_INCLUDE_DIR}) set(TinyXML_INCLUDE_DIRS ${TinyXML_INCLUDE_DIR})
set(TinyXML_LIBRARIES ${TinyXML_LIBRARY}) set(TinyXML_LIBRARIES ${TinyXML_LIBRARY})
endif() endif()

@ -1,155 +1,155 @@
IF(UNIX) if(UNIX)
IF(NOT APPLE) if(NOT APPLE)
# Linux: Check for unresolved symbols at link time # Linux: Check for unresolved symbols at link time
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-z,defs") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-z,defs")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-z,defs") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-z,defs")
ENDIF() endif()
ENDIF() endif()
include_directories("${dfhack_SOURCE_DIR}/library/include") include_directories("${dfhack_SOURCE_DIR}/library/include")
include_directories("${dfhack_SOURCE_DIR}/library/proto") include_directories("${dfhack_SOURCE_DIR}/library/proto")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/proto") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/proto")
include_directories("${dfhack_SOURCE_DIR}/library/depends/xgetopt") include_directories("${dfhack_SOURCE_DIR}/library/depends/xgetopt")
MACRO(CAR var) macro(car var)
SET(${var} ${ARGV1}) set(${var} ${ARGV1})
ENDMACRO() endmacro()
MACRO(CDR var junk) macro(cdr var junk)
SET(${var} ${ARGN}) set(${var} ${ARGN})
ENDMACRO() endmacro()
MACRO(LIST_CONTAINS var value) macro(list_contains var value)
SET(${var}) set(${var})
FOREACH (value2 ${ARGN}) foreach(value2 ${ARGN})
IF (${value} STREQUAL ${value2}) if(${value} STREQUAL ${value2})
SET(${var} TRUE) set(${var} TRUE)
ENDIF() endif()
ENDFOREACH() endforeach()
ENDMACRO() endmacro()
MACRO(PARSE_ARGUMENTS prefix arg_names option_names) macro(parse_arguments prefix arg_names option_names)
SET(DEFAULT_ARGS) set(DEFAULT_ARGS)
FOREACH(arg_name ${arg_names}) foreach(arg_name ${arg_names})
SET(${prefix}_${arg_name}) set(${prefix}_${arg_name})
ENDFOREACH() endforeach()
FOREACH(option ${option_names}) foreach(option ${option_names})
SET(${prefix}_${option} FALSE) set(${prefix}_${option} FALSE)
ENDFOREACH() endforeach()
SET(current_arg_name DEFAULT_ARGS) set(current_arg_name DEFAULT_ARGS)
SET(current_arg_list) set(current_arg_list)
FOREACH(arg ${ARGN}) foreach(arg ${ARGN})
LIST_CONTAINS(is_arg_name ${arg} ${arg_names}) list_contains(is_arg_name ${arg} ${arg_names})
IF (is_arg_name) if(is_arg_name)
SET(${prefix}_${current_arg_name} ${current_arg_list}) set(${prefix}_${current_arg_name} ${current_arg_list})
SET(current_arg_name ${arg}) set(current_arg_name ${arg})
SET(current_arg_list) set(current_arg_list)
ELSE() else()
LIST_CONTAINS(is_option ${arg} ${option_names}) list_contains(is_option ${arg} ${option_names})
IF(is_option) if(is_option)
SET(${prefix}_${arg} TRUE) set(${prefix}_${arg} TRUE)
ELSE() else()
SET(current_arg_list ${current_arg_list} ${arg}) set(current_arg_list ${current_arg_list} ${arg})
ENDIF() endif()
ENDIF() endif()
ENDFOREACH() endforeach()
SET(${prefix}_${current_arg_name} ${current_arg_list}) set(${prefix}_${current_arg_name} ${current_arg_list})
ENDMACRO() endmacro()
MACRO(DFHACK_PLUGIN) macro(dfhack_plugin)
PARSE_ARGUMENTS(PLUGIN parse_arguments(PLUGIN
"LINK_LIBRARIES;DEPENDS;PROTOBUFS;COMPILE_FLAGS;COMPILE_FLAGS_GCC;COMPILE_FLAGS_MSVC" "LINK_LIBRARIES;DEPENDS;PROTOBUFS;COMPILE_FLAGS;COMPILE_FLAGS_GCC;COMPILE_FLAGS_MSVC"
"SOME_OPT" "SOME_OPT"
${ARGN} ${ARGN}
) )
CAR(PLUGIN_NAME ${PLUGIN_DEFAULT_ARGS}) car(PLUGIN_NAME ${PLUGIN_DEFAULT_ARGS})
CDR(PLUGIN_SOURCES ${PLUGIN_DEFAULT_ARGS}) cdr(PLUGIN_SOURCES ${PLUGIN_DEFAULT_ARGS})
SET(PLUGIN_PROTOS) set(PLUGIN_PROTOS)
FOREACH(pbuf ${PLUGIN_PROTOBUFS}) foreach(pbuf ${PLUGIN_PROTOBUFS})
LIST(APPEND PLUGIN_PROTOS ${CMAKE_CURRENT_SOURCE_DIR}/proto/${pbuf}.proto) list(APPEND PLUGIN_PROTOS ${CMAKE_CURRENT_SOURCE_DIR}/proto/${pbuf}.proto)
ENDFOREACH() endforeach()
LIST(LENGTH PLUGIN_PROTOS NUM_PROTO) list(LENGTH PLUGIN_PROTOS NUM_PROTO)
IF(NUM_PROTO) if(NUM_PROTO)
STRING(REPLACE ".proto" ".pb.cc" PLUGIN_PROTO_SRCS "${PLUGIN_PROTOS}") string(REPLACE ".proto" ".pb.cc" PLUGIN_PROTO_SRCS "${PLUGIN_PROTOS}")
STRING(REPLACE ".proto" ".pb.h" PLUGIN_PROTO_HDRS "${PLUGIN_PROTOS}") string(REPLACE ".proto" ".pb.h" PLUGIN_PROTO_HDRS "${PLUGIN_PROTOS}")
STRING(REPLACE "/proto/" "/proto/tmp/" PLUGIN_PROTO_TMP_FILES "${PLUGIN_PROTO_SRCS};${PLUGIN_PROTO_HDRS}") string(REPLACE "/proto/" "/proto/tmp/" PLUGIN_PROTO_TMP_FILES "${PLUGIN_PROTO_SRCS};${PLUGIN_PROTO_HDRS}")
SET_SOURCE_FILES_PROPERTIES(${PLUGIN_PROTO_SRCS} ${PLUGIN_PROTO_HDRS} PROPERTIES GENERATED TRUE) set_source_files_properties(${PLUGIN_PROTO_SRCS} ${PLUGIN_PROTO_HDRS} PROPERTIES GENERATED TRUE)
# Force a re-gen if any *.pb.* files are missing # Force a re-gen if any *.pb.* files are missing
# (only runs when cmake is run, but better than nothing) # (only runs when cmake is run, but better than nothing)
FOREACH(file IN LISTS PLUGIN_PROTO_SRCS PLUGIN_PROTO_HDRS) foreach(file IN LISTS PLUGIN_PROTO_SRCS PLUGIN_PROTO_HDRS)
IF(NOT EXISTS ${file}) if(NOT EXISTS ${file})
# MESSAGE("Resetting generate_proto_${PLUGIN_NAME} because '${file}' is missing") # MESSAGE("Resetting generate_proto_${PLUGIN_NAME} because '${file}' is missing")
FILE(REMOVE ${PLUGIN_PROTO_TMP_FILES}) file(REMOVE ${PLUGIN_PROTO_TMP_FILES})
BREAK() break()
ENDIF() endif()
ENDFOREACH() endforeach()
ADD_CUSTOM_COMMAND( add_custom_command(
OUTPUT ${PLUGIN_PROTO_TMP_FILES} OUTPUT ${PLUGIN_PROTO_TMP_FILES}
COMMAND protoc-bin -I=${CMAKE_CURRENT_SOURCE_DIR}/proto/ COMMAND protoc-bin -I=${CMAKE_CURRENT_SOURCE_DIR}/proto/
--cpp_out=${CMAKE_CURRENT_SOURCE_DIR}/proto/tmp/ --cpp_out=${CMAKE_CURRENT_SOURCE_DIR}/proto/tmp/
${PLUGIN_PROTOS} ${PLUGIN_PROTOS}
COMMAND ${PERL_EXECUTABLE} ${CMAKE_SOURCE_DIR}/depends/copy-if-different.pl COMMAND ${PERL_EXECUTABLE} ${CMAKE_SOURCE_DIR}/depends/copy-if-different.pl
${PLUGIN_PROTO_TMP_FILES} ${PLUGIN_PROTO_TMP_FILES}
${CMAKE_CURRENT_SOURCE_DIR}/proto/ ${CMAKE_CURRENT_SOURCE_DIR}/proto/
COMMENT "Generating plugin ${PLUGIN_NAME} protobufs" COMMENT "Generating plugin ${PLUGIN_NAME} protobufs"
DEPENDS protoc-bin ${PLUGIN_PROTOS} DEPENDS protoc-bin ${PLUGIN_PROTOS}
) )
IF(UNIX) if(UNIX)
SET_SOURCE_FILES_PROPERTIES(${PLUGIN_PROTO_SRCS} PROPERTIES COMPILE_FLAGS "-Wno-misleading-indentation") set_source_files_properties(${PLUGIN_PROTO_SRCS} PROPERTIES COMPILE_FLAGS "-Wno-misleading-indentation")
ENDIF() endif()
ADD_CUSTOM_TARGET(generate_proto_${PLUGIN_NAME} DEPENDS ${PLUGIN_PROTO_TMP_FILES}) add_custom_target(generate_proto_${PLUGIN_NAME} DEPENDS ${PLUGIN_PROTO_TMP_FILES})
# Merge headers into sources # Merge headers into sources
SET_SOURCE_FILES_PROPERTIES( ${PLUGIN_PROTO_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE ) set_source_files_properties( ${PLUGIN_PROTO_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE )
LIST(APPEND PLUGIN_SOURCES ${PLUGIN_PROTO_HDRS}) list(APPEND PLUGIN_SOURCES ${PLUGIN_PROTO_HDRS})
LIST(APPEND PLUGIN_SOURCES ${PLUGIN_PROTO_SRCS}) list(APPEND PLUGIN_SOURCES ${PLUGIN_PROTO_SRCS})
IF(UNIX) if(UNIX)
SET(PLUGIN_COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS} -include Export.h") set(PLUGIN_COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS} -include Export.h")
ELSE() else()
SET(PLUGIN_COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS} /FI\"Export.h\"") set(PLUGIN_COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS} /FI\"Export.h\"")
ENDIF() endif()
ENDIF() endif()
ADD_LIBRARY(${PLUGIN_NAME} MODULE ${PLUGIN_SOURCES}) add_library(${PLUGIN_NAME} MODULE ${PLUGIN_SOURCES})
IDE_FOLDER(${PLUGIN_NAME} "Plugins") ide_folder(${PLUGIN_NAME} "Plugins")
IF(NUM_PROTO) if(NUM_PROTO)
ADD_DEPENDENCIES(${PLUGIN_NAME} generate_proto_${PLUGIN_NAME}) add_dependencies(${PLUGIN_NAME} generate_proto_${PLUGIN_NAME})
TARGET_LINK_LIBRARIES(${PLUGIN_NAME} dfhack protobuf-lite dfhack-version ${PLUGIN_LINK_LIBRARIES}) target_link_libraries(${PLUGIN_NAME} dfhack protobuf-lite dfhack-version ${PLUGIN_LINK_LIBRARIES})
ELSE() else()
TARGET_LINK_LIBRARIES(${PLUGIN_NAME} dfhack dfhack-version ${PLUGIN_LINK_LIBRARIES}) target_link_libraries(${PLUGIN_NAME} dfhack dfhack-version ${PLUGIN_LINK_LIBRARIES})
ENDIF() endif()
ADD_DEPENDENCIES(${PLUGIN_NAME} dfhack-version) add_dependencies(${PLUGIN_NAME} dfhack-version)
# Make sure the source is generated before the executable builds. # Make sure the source is generated before the executable builds.
ADD_DEPENDENCIES(${PLUGIN_NAME} generate_proto) add_dependencies(${PLUGIN_NAME} generate_proto)
IF(UNIX) if(UNIX)
SET(PLUGIN_COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS} ${PLUGIN_COMPILE_FLAGS_GCC}") set(PLUGIN_COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS} ${PLUGIN_COMPILE_FLAGS_GCC}")
ELSE() else()
SET(PLUGIN_COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS} ${PLUGIN_COMPILE_FLAGS_MSVC}") set(PLUGIN_COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS} ${PLUGIN_COMPILE_FLAGS_MSVC}")
ENDIF() endif()
SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS}") set_target_properties(${PLUGIN_NAME} PROPERTIES COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS}")
IF(APPLE) if(APPLE)
SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES SUFFIX .plug.dylib PREFIX "") set_target_properties(${PLUGIN_NAME} PROPERTIES SUFFIX .plug.dylib PREFIX "")
ELSEIF(UNIX) elseif(UNIX)
SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES SUFFIX .plug.so PREFIX "") set_target_properties(${PLUGIN_NAME} PROPERTIES SUFFIX .plug.so PREFIX "")
ELSE() else()
SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES SUFFIX .plug.dll) set_target_properties(${PLUGIN_NAME} PROPERTIES SUFFIX .plug.dll)
ENDIF() endif()
install(TARGETS ${PLUGIN_NAME} install(TARGETS ${PLUGIN_NAME}
LIBRARY DESTINATION ${DFHACK_PLUGIN_DESTINATION} LIBRARY DESTINATION ${DFHACK_PLUGIN_DESTINATION}
RUNTIME DESTINATION ${DFHACK_PLUGIN_DESTINATION}) RUNTIME DESTINATION ${DFHACK_PLUGIN_DESTINATION})
ENDMACRO(DFHACK_PLUGIN) endmacro()