| 1 | add_definitions( -DTCL_THREADS -DTOLBASE_VERSION=\"${TOLBASE_VERSION_MAJOR}.${TOLBASE_VERSION_MINOR}\") |
|---|
| 2 | include_directories( ${TCL_INCLUDE_PATH} ) |
|---|
| 3 | |
|---|
| 4 | message( STATUS "Using TCL_INCLUDE_PATH = ${TCL_INCLUDE_PATH}" ) |
|---|
| 5 | message( STATUS "Using TCL_LIBRARY = ${TCL_LIBRARY}" ) |
|---|
| 6 | message( STATUS "Using TK_LIBRARY = ${TK_LIBRARY}" ) |
|---|
| 7 | |
|---|
| 8 | if ( WIN32 ) |
|---|
| 9 | set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -mwindows" ) |
|---|
| 10 | else ( WIN32 ) |
|---|
| 11 | # use, i.e. don't skip the full RPATH for the build tree |
|---|
| 12 | SET(CMAKE_SKIP_BUILD_RPATH FALSE) |
|---|
| 13 | |
|---|
| 14 | # when building, don't use the install RPATH already |
|---|
| 15 | # (but later on when installing) |
|---|
| 16 | SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) |
|---|
| 17 | |
|---|
| 18 | SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") |
|---|
| 19 | |
|---|
| 20 | # add the automatically determined parts of the RPATH |
|---|
| 21 | # which point to directories outside the build tree to the install RPATH |
|---|
| 22 | SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) |
|---|
| 23 | |
|---|
| 24 | # the RPATH to be used when installing, but only if it's not a system directory |
|---|
| 25 | LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) |
|---|
| 26 | IF("${isSystemDir}" STREQUAL "-1") |
|---|
| 27 | SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") |
|---|
| 28 | ENDIF("${isSystemDir}" STREQUAL "-1") |
|---|
| 29 | endif( WIN32 ) |
|---|
| 30 | |
|---|
| 31 | set(RES_FILES "") |
|---|
| 32 | if(MINGW) |
|---|
| 33 | set(RES_FILES "tolbase-gnu.rc") |
|---|
| 34 | set(CMAKE_RC_COMPILER_INIT windres) |
|---|
| 35 | ENABLE_LANGUAGE(RC) |
|---|
| 36 | SET(CMAKE_RC_COMPILE_OBJECT |
|---|
| 37 | "<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>") |
|---|
| 38 | endif(MINGW) |
|---|
| 39 | |
|---|
| 40 | add_executable( tolbase tolbase.c ${RES_FILES}) |
|---|
| 41 | |
|---|
| 42 | target_link_libraries( tolbase ${TCL_LIBRARY} ${TK_LIBRARY} ) |
|---|
| 43 | |
|---|
| 44 | message( STATUS "TOLBASE_DEST_DIR = ${TOLBASE_DEST_DIR}" ) |
|---|
| 45 | install( TARGETS tolbase RUNTIME DESTINATION "bin" ) |
|---|