I'm new to developing using awesomium and I'm trying to get the helo world example running within Ubuntu. I'm using CLion which is using CMake as a build system. I was wondering how to link to Awesomium successfully using CMake.
I figured it out after a long wave of trial and error:
CMakeList.txt:
cmake_minimum_required(VERSION 3.3)
project(LetsChat)
set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(SOURCE_FILES main.cpp)
find_package (Awesomium REQUIRED)
include_directories (${AWESOMIUM_INCLUDE_DIR})
add_executable(LetsChat ${SOURCE_FILES})
target_link_libraries(LetsChat ${AWESOMIUM_LIBRARY})
FindAwesomium.cmake (Under CMake subdirectory)
include (FindPackageHandleStandardArgs)
find_path(AWESOMIUM_INCLUDE_DIR Awesomium/WebCore.h
PATH_SUFFIXES include
PATHS
${AWESOMIUM_ROOT}
$ENV{AWESOMIUM_ROOT}
~/Library/Frameworks
/Library/Frameworks
/usr/local/
/usr/
/sw # Fink
/opt/local/ # DarwinPorts
/opt/csw/ # Blastwave
/opt/)
find_library(AWESOMIUM_LIBRARY
NAMES libawesomium-1-7.so
PATH_SUFFIXES lib64 lib build/lib
PATHS
${AWESOMIUM_ROOT}
$ENV{AWESOMIUM_ROOT}
~/Library/Frameworks
/Library/Frameworks
/usr/local/
/usr/lib/
/usr/
/sw # Fink
/opt/local/ # DarwinPorts
/opt/csw/ # Blastwave
/opt/)
find_package_handle_standard_args (Awesomium DEFAULT_MSG AWESOMIUM_INCLUDE_DIR AWESOMIUM_LIBRARY)
mark_as_advanced (AWESOMIUM_INCLUDE_DIR AWESOMIUM_LIBRARY)
if (AWESOMIUM_FOUND)
message (STATUS "Found Awesomium: ${AWESOMIUM_INCLUDE_DIR}")
endif ()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.