Update requires in xmake.lua of README.md.
[liba.git] / quickjs / CMakeLists.txt
blobaeeae2d3651a1c72e42d0dc220db25f14f02a5a4
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(EXISTS ${CMAKE_CURRENT_LIST_DIR}/test/CMakeLists.txt AND QJS_EXECUTABLE)
25   get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
27   if(NOT CMAKE_VERSION VERSION_LESS 3.0)
28     set(WORKING_DIRECTORY $<TARGET_FILE_DIR:aqjs>)
29   elseif(IS_MULTI_CONFIG)
30     set(WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>)
31   else()
32     set(WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
33   endif()
35   add_subdirectory(test)
36 endif()