summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorPeter Johnson <peter@tortall.net>2014-08-10 21:38:48 -0700
committerPeter Johnson <peter@tortall.net>2014-08-10 23:18:46 -0700
commit636dc92558efd052cd0553203f67068171a3116c (patch)
tree5bb4f3aea44713caf767c4296ebeac2699cd0ccb /modules
parent24e01c833fa94947ff815099170311355ad39949 (diff)
downloadyasm-636dc92558efd052cd0553203f67068171a3116c.tar.gz
Allow building of static executables with cmake.
Diffstat (limited to 'modules')
-rw-r--r--modules/CMakeLists.txt36
1 files changed, 23 insertions, 13 deletions
diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt
index 48a3b5cf..e3f8eb11 100644
--- a/modules/CMakeLists.txt
+++ b/modules/CMakeLists.txt
@@ -56,9 +56,11 @@ IF(regen_init_plugin_c)
FILE(APPEND ${INIT_PLUGIN_C}
"extern yasm_${_type}_module yasm_${_keyword}_LTX_${_type};\n")
ENDFOREACH(module)
- FILE(APPEND ${INIT_PLUGIN_C} "\n#ifdef _MSC_VER\n")
- FILE(APPEND ${INIT_PLUGIN_C} "__declspec(dllexport)\n")
- FILE(APPEND ${INIT_PLUGIN_C} "#endif\n")
+ IF(BUILD_SHARED_LIBS)
+ FILE(APPEND ${INIT_PLUGIN_C} "\n#ifdef _MSC_VER\n")
+ FILE(APPEND ${INIT_PLUGIN_C} "__declspec(dllexport)\n")
+ FILE(APPEND ${INIT_PLUGIN_C} "#endif\n")
+ ENDIF(BUILD_SHARED_LIBS)
FILE(APPEND ${INIT_PLUGIN_C} "void\n")
FILE(APPEND ${INIT_PLUGIN_C} "yasm_init_plugin(void)\n")
FILE(APPEND ${INIT_PLUGIN_C} "{\n")
@@ -80,14 +82,22 @@ SET_SOURCE_FILES_PROPERTIES(init_plugin.c GENERATED)
SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})
-ADD_LIBRARY(yasmstd MODULE
- init_plugin.c
- ${YASM_MODULES_SRC}
- )
-TARGET_LINK_LIBRARIES(yasmstd libyasm)
+IF(BUILD_SHARED_LIBS)
+ ADD_LIBRARY(yasmstd MODULE
+ init_plugin.c
+ ${YASM_MODULES_SRC}
+ )
+ TARGET_LINK_LIBRARIES(yasmstd libyasm)
-IF(WIN32)
- INSTALL(TARGETS yasmstd LIBRARY DESTINATION bin)
-ELSE(WIN32)
- INSTALL(TARGETS yasmstd LIBRARY DESTINATION lib)
-ENDIF(WIN32)
+ IF(WIN32)
+ INSTALL(TARGETS yasmstd LIBRARY DESTINATION bin)
+ ELSE(WIN32)
+ INSTALL(TARGETS yasmstd LIBRARY DESTINATION lib)
+ ENDIF(WIN32)
+ELSE(BUILD_SHARED_LIBS)
+ ADD_LIBRARY(yasmstd
+ init_plugin.c
+ ${YASM_MODULES_SRC}
+ )
+ TARGET_LINK_LIBRARIES(yasmstd libyasm)
+ENDIF(BUILD_SHARED_LIBS)