xref: /6.0.3/tlm/deps/packages/icu4c/icu4c_unix.cmake (revision 8bbe7c2d)
1# Downloads the declared version of icu4c source code and builds it.
2
3include(ExternalProject)
4
5# For APPLE we anyway set rpaths using install_name_tool below
6if (APPLE)
7    SET(_rpath_options "")
8    SET(_rpath-link_options "")
9else (APPLE)
10    SET(_rpath_options "--enable-rpath")
11    SET(_rpath-link_options "--enable-rpath-link")
12endif (APPLE)
13### Download, configure and build icu4c ####################################
14_DETERMINE_CPU_COUNT(_parallelism)
15ExternalProject_Add(icu4c
16  GIT_REPOSITORY ${_git_repo}
17  GIT_TAG ${_git_rev}
18
19 CONFIGURE_COMMAND sudo "${CMAKE_CURRENT_SOURCE_DIR}/check_xlocale_h.sh"
20 COMMAND <SOURCE_DIR>/source/configure LDFLAGS=${ICU_LDFLAGS}
21                                                  --prefix=<INSTALL_DIR>
22                                                  --disable-extras
23                                                  --disable-layout
24                                                  --disable-tests
25                                                  --disable-samples
26                                                  ${_rpath_options}
27                                                  ${_rpath-link_options}
28  BUILD_COMMAND $(MAKE) -j${_parallelism} all
29
30  INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/install
31  INSTALL_COMMAND $(MAKE) install
32          COMMAND ${CMAKE_COMMAND} -E remove_directory <INSTALL_DIR>/bin
33          COMMAND ${CMAKE_COMMAND} -E remove_directory <INSTALL_DIR>/sbin
34          COMMAND ${CMAKE_COMMAND} -E remove_directory <INSTALL_DIR>/share
35
36  COMMAND ${CMAKE_COMMAND} -E echo "FILE(COPY lib DESTINATION \${CMAKE_INSTALL_PREFIX})" >> <INSTALL_DIR>/CMakeLists.txt
37)
38
39# OS X-only: Custom post-build step to set the shared library install name.
40if (APPLE)
41  ExternalProject_Add_Step(icu4c install_name
42    # Fixup all libraries
43    COMMAND install_name_tool -id @rpath/libicudata.59.1.dylib lib/libicudata.59.1.dylib
44    COMMAND install_name_tool -id @rpath/libicui18n.59.1.dylib
45                              -change libicuuc.59.dylib @loader_path/libicuuc.59.dylib
46                              -change libicudata.59.dylib @loader_path/libicudata.59.dylib
47                              lib/libicui18n.59.1.dylib
48    COMMAND install_name_tool -id @rpath/libicuio.59.1.dylib
49                              -change libicuuc.59.dylib @loader_path/libicuuc.59.dylib
50                              -change ../lib/libicudata.59.1.dylib @loader_path/libicudata.59.1.dylib
51                              -change libicui18n.59.dylib @loader_path/ibicui18n.59.dylib
52                              lib/libicuio.59.1.dylib
53    COMMAND install_name_tool -id @rpath/libicutu.59.1.dylib
54                              -change libicui18n.59.dylib @loader_path/libicui18n.59.dylib
55                              -change libicuuc.59.dylib @loader_path/libicuuc.59.dylib
56                              -change libicudata.59.dylib @loader_path/libicudata.59.dylib
57                              lib/libicutu.59.1.dylib
58    COMMAND install_name_tool -id @rpath/libicuuc.59.1.dylib
59                              -change libicudata.59.dylib @loader_path/libicudata.59.dylib
60                              lib/libicuuc.59.1.dylib
61    DEPENDEES build
62    DEPENDERS install
63    WORKING_DIRECTORY <BINARY_DIR>
64  )
65endif(APPLE)
66