vcpkg/ports/lua/CMakeLists-cpp.txt
Jack·Boos·Yu 32d25e6b85
[lua] Fix library type and usage (#24436)
* [lua] Fix library type and usage

* version

* Use c code in executables

* version

* Apply suggestion

* version

* Add an extra CMakeLists.txt to avoid scope pollution of SET_SOURCE_FILES_PROPERTIES

* version

* Apply suggestions

* version

* Various nitpicks:

* Use "supports" on features rather than if tests plus message FATAL_ERROR
* Deduplicate ENABLE_LUA_CPP and COMPILE_AS_CPP
* Add quotes.
* Use file(INSTALL rather than configure_file(COPYONLY)

Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
2022-05-13 15:02:20 -07:00

29 lines
1.0 KiB
Plaintext

SET(SRC_LIBLUACPP ${SRC_LIBLUA})
ADD_LIBRARY ( lua-cpp ${SRC_LIBLUACPP} ${HDR_LIBLUACPP} )
SET_TARGET_PROPERTIES(lua-cpp PROPERTIES OUTPUT_NAME "lua-c++")
SET_SOURCE_FILES_PROPERTIES(${SRC_LIBLUACPP} PROPERTIES LANGUAGE CXX)
TARGET_INCLUDE_DIRECTORIES(lua-cpp PRIVATE $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src> PUBLIC $<INSTALL_INTERFACE:include>)
IF (BUILD_SHARED_LIBS AND WIN32)
TARGET_COMPILE_DEFINITIONS (lua-cpp PUBLIC -DLUA_BUILD_AS_DLL )
ENDIF ()
IF (UNIX)
IF (APPLE)
TARGET_COMPILE_DEFINITIONS (lua-cpp PUBLIC -DLUA_USE_DLOPEN)
ELSE ()
FIND_LIBRARY (LIB_DLOPEN NAMES dl)
IF (LIB_DLOPEN)
TARGET_COMPILE_DEFINITIONS (lua-cpp PUBLIC -DLUA_USE_DLOPEN)
TARGET_LINK_LIBRARIES (lua-cpp ${LIB_DLOPEN})
ENDIF ()
ENDIF ()
ENDIF ()
INSTALL ( TARGETS lua-cpp
EXPORT unofficial-lua-cpp-config
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
INSTALL(EXPORT unofficial-lua-cpp-config DESTINATION share/unofficial-lua-cpp)