From 854e1bebda7d64fa42f5e503acb9021f7c4dad76 Mon Sep 17 00:00:00 2001 From: Hombre Date: Sun, 13 Feb 2011 23:45:21 +0100 Subject: [PATCH] Adding Steve Herell's CMakeLists.txt patch --- About-Linux.cmake | 16 +++++++++++++--- About-Windows.cmake | 6 +++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/About-Linux.cmake b/About-Linux.cmake index 23307b125..22a02aa1a 100644 --- a/About-Linux.cmake +++ b/About-Linux.cmake @@ -3,6 +3,16 @@ string (TOUPPER ${BUILD_TYPE} UPPER_CMAKE_BUILD_TYPE) +# wee look for the hg command in this paths by order of preference +find_file(HG_CMD hg PATHS "/opt/local/bin" "/usr/local/bin" "/usr/bin") +find_file(HG_CMD hg) + +if (HG_CMD STREQUAL HG_CMD-NOTFOUND) + message(FATAL_ERROR "hg command not found!") +else (HG_CMD STREQUAL HG_CMD-NOTFOUND) + message(STATUS "hg command found: ${HG_CMD}") +endif (HG_CMD STREQUAL HG_CMD-NOTFOUND) + set (OUT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/AboutThisBuild.txt") set (VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/rtgui/version.h") set (SHELL "/bin/bash") @@ -11,8 +21,8 @@ set (SHELL "/bin/bash") add_custom_target (AboutFile ALL COMMAND rm -f ${OUT_FILE} COMMAND rm -f ${VERSION_FILE} - COMMAND for i in \$\( hg branch \)\; do echo Branch: $i >${OUT_FILE}\; done - COMMAND hg parents --template=\"Version: {latesttag}.{latesttagdistance}\\nChangset: {node|short}\\n\" >>${OUT_FILE} + COMMAND for i in \$\( ${HG_CMD} -R \"${CMAKE_CURRENT_SOURCE_DIR}\" branch \)\; do echo Branch: $i >${OUT_FILE}\; done + COMMAND ${HG_CMD} -R \"${CMAKE_CURRENT_SOURCE_DIR}\" parents --template=\"Version: {latesttag}.{latesttagdistance}\\nChangset: {node|short}\\n\" >>${OUT_FILE} COMMAND for i in \$\( gcc -dumpversion \) \;do echo Compiler: GCC $i >>${OUT_FILE} \; done COMMAND echo Processor: ${PROC_LABEL} >>${OUT_FILE} COMMAND echo Bit depth: ${PROC_BIT_DEPTH} >>${OUT_FILE} @@ -22,6 +32,6 @@ add_custom_target (AboutFile ALL COMMAND if [ \"${OPTION_OMP}\" = \"ON\" ] \; then echo OpenMP support: Yes >>${OUT_FILE} \;else echo OpenMP support: No >>${OUT_FILE} \;fi COMMAND if [ \"${WITH_MYFILE_MMAP}\" = \"ON\" ] \; then echo MMAP support: Yes >>${OUT_FILE} \; else echo MMAP support: No >>${OUT_FILE} \;fi COMMAND if [ \"${WITH_RAWZOR}\" = \"ON\" ] \; then echo Rawzor support: Yes >>${OUT_FILE} \;else echo Rawzor support: No >>${OUT_FILE} \;fi - COMMAND hg parents --template=\"// This file is automatically generated by the Makefile \; DO NOT EDIT!\\n// You can \(should\) also tell mercurial to ignore it.\\n\\n\#ifndef _VERSION_\\n\#define _VERSION_\\n\\n\#define VERSION \\"{latesttag}.{latesttagdistance}\\"\\n\#define TAGDISTANCE {latesttagdistance}\\n\\n\#endif\\n\" >${VERSION_FILE} + COMMAND ${HG_CMD} -R \"${CMAKE_CURRENT_SOURCE_DIR}\" parents --template=\"// This file is automatically generated by the Makefile \; DO NOT EDIT!\\n// You can \(should\) also tell mercurial to ignore it.\\n\\n\#ifndef _VERSION_\\n\#define _VERSION_\\n\\n\#define VERSION \\"{latesttag}.{latesttagdistance}\\"\\n\#define TAGDISTANCE {latesttagdistance}\\n\\n\#endif\\n\" >${VERSION_FILE} COMMENT "Creating the about file" ) diff --git a/About-Windows.cmake b/About-Windows.cmake index c4b8810ce..6f591d2b4 100644 --- a/About-Windows.cmake +++ b/About-Windows.cmake @@ -7,8 +7,8 @@ set (OUT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/AboutThisBuild.txt") set (VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/rtgui/version.h") add_custom_target (AboutFile ALL - COMMAND for /F \"tokens=*\" %%i in \('hg branch'\) do echo Branch: %%i >${OUT_FILE} - COMMAND hg parents --template=\"Version: {latesttag}.{latesttagdistance}\\nChangset: {node|short}\\n\" >>${OUT_FILE} + COMMAND for /F \"tokens=*\" %%i in \('hg -R \"${CMAKE_CURRENT_SOURCE_DIR}\" branch'\) do echo Branch: %%i >${OUT_FILE} + COMMAND hg -R \"${CMAKE_CURRENT_SOURCE_DIR}\" parents --template=\"Version: {latesttag}.{latesttagdistance}\\nChangset: {node|short}\\n\" >>${OUT_FILE} COMMAND for /F \"tokens=*\" %%i in \('gcc -dumpversion'\) do echo Compiler: GCC%%i >>${OUT_FILE} COMMAND \(echo Processor: ${PROC_LABEL}\) >>${OUT_FILE} COMMAND \(echo Bit depth: ${PROC_BIT_DEPTH}\) >>${OUT_FILE} @@ -18,6 +18,6 @@ add_custom_target (AboutFile ALL COMMAND (if ${OPTION_OMP}==ON \(echo OpenMP support: Yes\) else \(echo OpenMP support: No\)) >>${OUT_FILE} COMMAND (if ${WITH_MYFILE_MMAP}==ON \(echo MMAP support: Yes\) else \(echo MMAP support: No\)) >>${OUT_FILE} COMMAND (if ${WITH_RAWZOR}==ON \(echo Rawzor support: Yes\) else \(echo Rawzor support: No\)) >>${OUT_FILE} - COMMAND hg parents --template=\"// This file is automatically generated by the Makefile \; DO NOT EDIT!\\n// You can \(should\) also tell mercurial to ignore it.\\n\\n\#ifndef _VERSION_\\n\#define _VERSION_\\n\\n\#define VERSION \\"{latesttag}.{latesttagdistance}\\"\\n\#define TAGDISTANCE {latesttagdistance}\\n\\n\#endif\\n\" >${VERSION_FILE} + COMMAND hg -R \"${CMAKE_CURRENT_SOURCE_DIR}\" parents --template=\"// This file is automatically generated by the Makefile \; DO NOT EDIT!\\n// You can \(should\) also tell mercurial to ignore it.\\n\\n\#ifndef _VERSION_\\n\#define _VERSION_\\n\\n\#define VERSION \\"{latesttag}.{latesttagdistance}\\"\\n\#define TAGDISTANCE {latesttagdistance}\\n\\n\#endif\\n\" >${VERSION_FILE} COMMENT "Creating the about file" )