File: CMakeLists.txt

package info (click to toggle)
codelite 14.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 112,816 kB
  • sloc: cpp: 483,662; ansic: 150,144; php: 9,569; lex: 4,186; python: 3,417; yacc: 2,820; sh: 1,147; makefile: 52; xml: 13
file content (114 lines) | stat: -rw-r--r-- 3,918 bytes parent folder | download | duplicates (2)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# define minimum cmake version
cmake_minimum_required(VERSION 2.6.2)

find_library(LIBHUNSPELL 
            # Fedora doesn't create a hunspell->hunspell-1.3 symlink, so explicitly look for (the current) full name
            NAMES hunspell hunspell-1.3  hunspell-1.4 hunspell-1.5 hunspell-1.6 hunspell-1.7
			if (CMAKE_SIZEOF_VOID_P EQUAL 8)
				HINTS /usr/lib /usr/lib/x86_64-linux-gnu/ /usr/lib64/
			endif()
            PATH_SUFFIXES lib)

find_path(  HUNSPELL_H
            NAMES hunspell.h
            HINTS
              ENV HUNSPELL_DIR
            PATHS
              /usr/include /usr/local/include /usr/include/hunspell /usr/local/include/hunspell
            PATH_SUFFIXES include/hunspell include)

if ( (LIBHUNSPELL STREQUAL "LIBHUNSPELL-NOTFOUND" OR HUNSPELL_H STREQUAL "HUNSPELL_H-NOTFOUND") AND NOT APPLE )
    message("    **")
    message("    ** NOTICE ** Could not locate libhunspell. SpellChecker plugin will not be build")
    message("    ** NOTICE ** Try installing libhunspell-dev package")
    message("    **")
else ()
    
    if (UNIX AND NOT APPLE)
        set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC" )
        set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC" )
    endif()

    if ( APPLE )
        add_definitions(-fPIC)
    endif()

    if ( APPLE) 
        set(LIBHUNSPELL ${CL_SRC_ROOT}/sdk/hunspell/lib/osx/libhunspell-1.3.0.dylib)
        set(HUNSPELL_H ${CL_SRC_ROOT}/sdk/hunspell/include/)
    endif()
    
    # set the plugin name here
    set( PLUGIN_NAME "SpellCheck")
    message("-- Found libhunspell: ${LIBHUNSPELL}, ${HUNSPELL_H}")
    
    # Our project is called 'plugin' this is how it will be called in
    # visual studio, and in our makefiles. 
    project( ${PLUGIN_NAME} )

    # It was noticed that when using MinGW gcc it is essential that 'core' is mentioned before 'base'.
    find_package(wxWidgets COMPONENTS ${WX_COMPONENTS} REQUIRED)

    # wxWidgets include (this will do all the magic to configure everything)
    include( "${wxWidgets_USE_FILE}" )

    # Include paths
    include_directories("${CL_SRC_ROOT}/SpellChecker" "${CL_SRC_ROOT}/Plugin" 
                        "${CL_SRC_ROOT}/sdk/wxsqlite3/include" 
                        "${CL_SRC_ROOT}/CodeLite" 
                        "${CL_SRC_ROOT}/PCH" 
                        "${CL_SRC_ROOT}/Interfaces"
                        "${HUNSPELL_H}"
                        )

    add_definitions(-DWXUSINGDLL_WXSQLITE3)
    add_definitions(-DWXUSINGDLL_CL)
    add_definitions(-DWXUSINGDLL_SDK)

    if ( USE_PCH )
        add_definitions(-include "${CL_PCH_FILE}")
        add_definitions(-Winvalid-pch)
    endif ( USE_PCH )

    FILE(GLOB SRCS "*.cpp")

    # Define the output
    add_library(${PLUGIN_NAME} SHARED ${SRCS})

    # Codelite plugins doesn't use the "lib" prefix.
    set_target_properties(${PLUGIN_NAME} PROPERTIES PREFIX "")
    target_link_libraries(${PLUGIN_NAME}
                          ${LINKER_OPTIONS}
                          ${wxWidgets_LIBRARIES}
                          ${LIBHUNSPELL}
                          libcodelite
                          plugin
                          )

    # Installation destination
    CL_INSTALL_PLUGIN(${PLUGIN_NAME})
    
    if(APPLE)
        install(
          DIRECTORY ${CL_SRC_ROOT}/SpellChecker/dics
          DESTINATION ${CMAKE_BINARY_DIR}/codelite.app/Contents/SharedSupport
          USE_SOURCE_PERMISSIONS
          PATTERN ".svn" EXCLUDE
          PATTERN ".git" EXCLUDE
        )
        
        # Install Hunspell library
        install(
          FILES ${LIBHUNSPELL}
          DESTINATION ${CMAKE_BINARY_DIR}/codelite.app/Contents/MacOS/
        )
    else()
        install(
          DIRECTORY ${CL_SRC_ROOT}/SpellChecker/dics
          DESTINATION ${CL_PREFIX}/share/codelite
          USE_SOURCE_PERMISSIONS
          PATTERN ".svn" EXCLUDE
          PATTERN ".git" EXCLUDE
        )
    endif()
endif()