fix emscripten builds on windows
[liba.git] / quickjs / CMakeLists.txt
blob03530f518567d0b672c68c562fdd33c64f1ad5fc
1 include(../cmake/QuickJSPIC.cmake)
2 set(CMAKE_SHARED_MODULE_SUFFIX .so)
4 if(WIN32)
5   set(CMAKE_SHARED_MODULE_PREFIX lib)
6 endif()
8 if(LIBA_CXX)
9   file_scaner(SOURCES RECURSE src EXT c h cc hh cpp hpp)
10 else()
11   file_scaner(SOURCES RECURSE src EXT c h)
12 endif()
14 add_library(aqjs MODULE $<TARGET_OBJECTS:a> ${SOURCES})
15 set_target_properties(aqjs PROPERTIES DEFINE_SYMBOL A_EXPORTS OUTPUT_NAME a)
16 target_include_directories(aqjs PRIVATE ${QUICKJS_INCLUDE_DIR})
17 add_library_properties(aqjs PRIVATE alib)
18 set_library_options(aqjs)
20 if(QUICKJS_PIC)
21   target_link_libraries(aqjs PRIVATE ${QUICKJS_LIBRARIES})
22 endif()
24 if("${LIBA_INSTALL}" MATCHES "^$|[Qq]uick[Jj][Ss]")
25   install(TARGETS aqjs
26     ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/quickjs
27     LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/quickjs
28   )
29 endif()
31 if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/test/CMakeLists.txt AND QJS_EXECUTABLE)
32   get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
34   if(NOT CMAKE_VERSION VERSION_LESS 3.0)
35     set(WORKING_DIRECTORY $<TARGET_FILE_DIR:aqjs>)
36   elseif(IS_MULTI_CONFIG)
37     set(WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>)
38   else()
39     set(WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
40   endif()
42   add_subdirectory(test)
43 endif()