2015-09-18 18:27:16 +00:00
|
|
|
cmake_minimum_required( VERSION 2.8.4 FATAL_ERROR )
|
2015-09-18 16:45:43 +00:00
|
|
|
|
2015-09-20 17:58:57 +00:00
|
|
|
if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR} )
|
2015-09-20 18:35:56 +00:00
|
|
|
message( FATAL_ERROR
|
|
|
|
"In-source builds not allowed. Please make a new directory (called"
|
|
|
|
" a build directory) and run CMake from there, points here."
|
|
|
|
" You may need to remove CMakeCache.txt." )
|
2015-09-20 17:58:57 +00:00
|
|
|
endif()
|
|
|
|
|
2015-09-18 16:45:43 +00:00
|
|
|
project( kicad-i18n NONE )
|
|
|
|
|
|
|
|
find_package( Gettext REQUIRED )
|
|
|
|
|
2015-09-19 09:00:02 +00:00
|
|
|
option( KICAD_I18N_UNIX_STRICT_PATH
|
|
|
|
"Use standard Unix locale lookup path (default OFF)."
|
|
|
|
OFF
|
|
|
|
)
|
|
|
|
|
2015-09-20 18:22:40 +00:00
|
|
|
if( UNIX AND KICAD_I18N_UNIX_STRICT_PATH )
|
2015-09-19 09:00:02 +00:00
|
|
|
set( KICAD_I18N_PATH ${CMAKE_INSTALL_PREFIX}/share/locale
|
|
|
|
CACHE PATH "Location of KiCad i18n files." )
|
|
|
|
else()
|
2015-09-19 09:17:40 +00:00
|
|
|
# Default Unix inconvenient locale lookup path
|
2015-09-19 09:00:02 +00:00
|
|
|
set( KICAD_I18N_PATH share/kicad/internat
|
|
|
|
CACHE PATH "Location of KiCad i18n files." )
|
|
|
|
endif()
|
|
|
|
|
2015-09-18 20:16:34 +00:00
|
|
|
file(STRINGS LINGUAS LANG_ARRAY REGEX "^[^#].*")
|
|
|
|
|
2015-09-18 16:53:02 +00:00
|
|
|
foreach( LANG ${LANG_ARRAY} )
|
2015-09-18 16:45:43 +00:00
|
|
|
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${LANG})
|
|
|
|
|
2015-09-18 16:53:02 +00:00
|
|
|
execute_process( COMMAND ${GETTEXT_MSGFMT_EXECUTABLE}
|
|
|
|
${CMAKE_SOURCE_DIR}/${LANG}/kicad.po
|
|
|
|
-o ${CMAKE_BINARY_DIR}/${LANG}/kicad.mo )
|
|
|
|
|
2015-09-20 18:22:40 +00:00
|
|
|
if( UNIX AND KICAD_I18N_UNIX_STRICT_PATH )
|
2015-09-19 09:00:02 +00:00
|
|
|
install( FILES ${CMAKE_BINARY_DIR}/${LANG}/kicad.mo
|
|
|
|
DESTINATION ${KICAD_I18N_PATH}/${LANG}/LC_MESSAGES
|
|
|
|
COMPONENT resources )
|
|
|
|
else()
|
|
|
|
install( FILES ${CMAKE_BINARY_DIR}/${LANG}/kicad.mo
|
|
|
|
DESTINATION ${KICAD_I18N_PATH}/${LANG}
|
|
|
|
COMPONENT resources )
|
|
|
|
endif()
|
2015-09-18 16:45:43 +00:00
|
|
|
endforeach()
|
|
|
|
|