| 1 |
|
| 2 |
set(CL_SRC_ROOT "${CMAKE_CURRENT_LIST_DIR}/..") |
| 3 |
|
| 4 |
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CL_SRC_ROOT}/cmake/Modules/") |
| 5 |
set(BUILD_DIRECTORY ${CMAKE_BINARY_DIR}) |
| 6 |
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}/lib") |
| 7 |
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}/bin") |
| 8 |
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}/lib") |
| 9 |
|
| 10 |
# Our project is called 'codelite' this is how it will be called in visual studio, and in our makefiles. |
| 11 |
project(codelite-cli) |
| 12 |
set(CMAKE_EXPORT_COMPILE_COMMANDS 1) |
| 13 |
|
| 14 |
# It was noticed that when using MinGW gcc it is essential that 'core' is mentioned before 'base'. |
| 15 |
|
| 16 |
include("${wxWidgets_USE_FILE}") |
| 17 |
|
| 18 |
if(APPLE) |
| 19 |
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++") |
| 20 |
else() |
| 21 |
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") |
| 22 |
endif() |
| 23 |
|
| 24 |
if(NOT CL_WX_CONFIG) |
| 25 |
set(CL_WX_CONFIG "wx-config") |
| 26 |
endif() |
| 27 |
|
| 28 |
# we need wxWidgets flags to be set only for the c++ files, so we do it like this by setting the CMAKE_CXX_FLAGS |
| 29 |
if(NOT MINGW) |
| 30 |
execute_process( |
| 31 |
COMMAND ${CL_WX_CONFIG} --cxxflags |
| 32 |
OUTPUT_VARIABLE WX_CXX_FLAGS |
| 33 |
OUTPUT_STRIP_TRAILING_WHITESPACE) |
| 34 |
else() |
| 35 |
execute_process( |
| 36 |
COMMAND sh ${CL_WX_CONFIG} --cxxflags |
| 37 |
OUTPUT_VARIABLE WX_CXX_FLAGS |
| 38 |
OUTPUT_STRIP_TRAILING_WHITESPACE) |
| 39 |
endif() |
| 40 |
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WX_CXX_FLAGS}") |
| 41 |
message("${WX_CXX_FLAGS}") |
| 42 |
|
| 43 |
# prepare list of files |
| 44 |
file( |
| 45 |
GLOB |
| 46 |
CODELITELIB_SRCS |
| 47 |
"${CL_SRC_ROOT}/CodeLite/SocketAPI/*.cpp" |
| 48 |
"${CL_SRC_ROOT}/sdk/wxsqlite3/src/*.cpp" |
| 49 |
"${CL_SRC_ROOT}/CodeLite/*.c" |
| 50 |
"${CL_SRC_ROOT}/CodeLite/*.cpp" |
| 51 |
"${CL_SRC_ROOT}/sdk/codelite_indexer/network/*.cpp" |
| 52 |
"${CL_SRC_ROOT}/codelite-cli/sqlite3.c") |
| 53 |
|
| 54 |
file(GLOB CODELITESERVER_SRCS "*.cpp") |
| 55 |
|
| 56 |
# and finally prepare list of includes directories |
| 57 |
include_directories("${CL_SRC_ROOT}/sdk/wxsqlite3/include" "${CL_SRC_ROOT}/CodeLite" |
| 58 |
"${CL_SRC_ROOT}/sdk/codelite_indexer/network") |
| 59 |
|
| 60 |
# Define the output |
| 61 |
add_library(codelitelib STATIC ${CODELITELIB_SRCS}) |
| 62 |
target_compile_definitions(codelitelib PRIVATE wxUSE_GUI=0) |
| 63 |
|
| 64 |
add_executable(codelite-cli ${CODELITESERVER_SRCS}) |
| 65 |
target_compile_definitions(codelite-cli PRIVATE wxUSE_GUI=0) |
| 66 |
|
| 67 |
set(UTIL_LIB "") |
| 68 |
if(UNIX) |
| 69 |
set(UTIL_LIB "-lutil -ldl") |
| 70 |
endif(UNIX) |
| 71 |
|
| 72 |
target_link_libraries(codelite-cli codelitelib ${LINKER_OPTIONS} ${wxWidgets_LIBRARIES} ${UTIL_LIB}) |
| 73 |
# add_subdirectory(codelite-client) |