-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.cmake
44 lines (37 loc) · 1.61 KB
/
config.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Code shamelessly copied from http://stackoverflow.com/questions/7876753/reusing-custom-makefile-for-static-library-with-cmake
include(CheckFunctionExists)
CHECK_FUNCTION_EXISTS(memrchr FOLLY_HAVE_MEMRCHR)
if (FOLLY_HAVE_MEMRCHR)
add_definitions("-DFOLLY_HAVE_MEMRCHR=1")
else()
add_definitions("-DFOLLY_HAVE_MEMRCHR=0")
endif()
# set the output destination
set(LIBSASS_LIBRARY ${CMAKE_CURRENT_SOURCE_DIR}/lib/libsass/lib/libsass.a)
# create a custom target called build_libsass that is part of ALL
# and will run each time you type make
add_custom_target(build_libsass ALL
COMMAND ${CMAKE_MAKE_PROGRAM}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib/libsass
COMMENT "Original libsass makefile target")
# now create an imported static target
add_library(libsass STATIC IMPORTED)
include_directories(AFTER SYSTEM lib/libsass/include)
# Import target "libsass" for configuration ""
set_property(TARGET libsass APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG)
set_target_properties(libsass PROPERTIES
IMPORTED_LOCATION_NOCONFIG "${LIBSASS_LIBRARY}")
# now you can use libsass as if it were a regular cmake built target in your project
add_dependencies(libsass build_libsass)
HHVM_EXTENSION(sass
ext_sass.cpp
src/ExceptionManager.cpp
src/SassTypesFactory.cpp
src/CustomFunctionBridge.cpp
src/CustomImporterBridge.cpp
)
HHVM_SYSTEMLIB(sass ext_sass.php)
target_link_libraries(sass libsass)
# note, this will only work on linux/unix platforms, also it does building
# in the source tree which is also sort of bad style and keeps out of source
# builds from working.