@@ -48,7 +48,7 @@ ENDIF(COMMAND CMAKE_POLICY)
4848PROJECT (SCL)
4949
5050if ( CMAKE_BUILD_TYPE STREQUAL "" )
51- message ( "Debug build - to override, rerun cmake with '-DCMAKE_BUILD_TYPE=Release'." )
51+ message ( "-- Debug build - to override, rerun cmake with '-DCMAKE_BUILD_TYPE=Release'." )
5252 set ( CMAKE_BUILD_TYPE Debug )
5353endif ()
5454
@@ -176,8 +176,8 @@ IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
176176 IF ("${CMAKE_BUILD_TYPE} " MATCHES "Release" )
177177 SET (CMAKE_INSTALL_PREFIX "/usr" )
178178 ELSEIF ("${CMAKE_BUILD_TYPE} " MATCHES "Debug" )
179- MESSAGE ("setting debug output dir" )
180179 SET (CMAKE_INSTALL_PREFIX "${SCL_SOURCE_DIR} /../scl-install" )
180+ MESSAGE ("--- Setting debug install dir to ${CMAKE_INSTALL_PREFIX} " )
181181 ELSE ("${CMAKE_BUILD_TYPE} " MATCHES "Release" )
182182 SET (CMAKE_INSTALL_PREFIX "/usr/local" )
183183 ENDIF ("${CMAKE_BUILD_TYPE} " MATCHES "Release" )
@@ -213,23 +213,26 @@ CHECK_FUNCTION_EXISTS(memmove HAVE_MEMMOVE)
213213
214214CHECK_TYPE_SIZE ("ssize_t" SSIZE_T )
215215
216- #set GIT_COMMIT_ID to the output of `git describe`
217- find_package (Git )
218- if (GIT_FOUND)
219- execute_process (COMMAND ${GIT_EXECUTABLE} describe --tags RESULT_VARIABLE res_var OUTPUT_VARIABLE GIT_COM_ID )
220- if ( NOT ${res_var} EQUAL 0 )
221- set ( GIT_COMMIT_ID "unknown (git failed!)" )
222- message ( WARNING "Git failed (not a repo?). Build will not contain git revision info." )
223- endif ()
224- string ( REPLACE "\n " "" GIT_COMMIT_ID ${GIT_COM_ID} )
225- else ()
226- set ( GIT_COMMIT_ID "unknown (git not found!)" )
227- message ( WARNING "Git not found. Build will not contain git revision info." )
228- endif ()
229-
230216# Now that all the tests are done, configure the scl_cf.h file:
231217configure_file (${SCL_BINARY_DIR} /include/scl_cf.h.in ${SCL_BINARY_DIR} /include/scl_cf.h )
232218
219+ ################ create scl_version_string.h, http://stackoverflow.com/questions/3780667
220+ # Using 'ver_string' instead of 'scl_version_string.h' is a trick to force the
221+ # command to always execute when the custom target is built. It works because
222+ # a file by that name never exists.
223+ add_custom_target (version_string ALL
224+ DEPENDS ver_string )
225+ # creates scl_version_string.h using cmake script
226+ add_custom_command (OUTPUT ver_string ${CMAKE_CURRENT_BINARY_DIR} /include/scl_version_string.h
227+ COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${SCL_SOURCE_DIR}
228+ -DBINARY_DIR=${SCL_BINARY_DIR}
229+ -P ${SCL_CMAKE_DIR} /scl_version_string.cmake )
230+ # scl_version_string.h is a generated file
231+ set_source_files_properties (${CMAKE_CURRENT_BINARY_DIR} /include/scl_version_string.h
232+ PROPERTIES GENERATED TRUE
233+ HEADER_FILE_ONLY TRUE )
234+ ################
235+
233236add_definitions ( -pedantic -W -Wall -Wundef -Wfloat-equal -Wshadow -Winline -Wno-long-long )
234237
235238include_directories (
0 commit comments