diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,29 +33,6 @@ else() message( FATAL_ERROR "Your operating system isn't supported yet! CMake will now exit." ) endif() -# Here we generate some of our code if we can. I package it pre-generated -# so nobody has to go find and install gengetopt if they don't want to. -find_program( GENGETOPT_EXECUTABLE gengetopt - DOC "A tool to generate code to grab command line options." ) -find_program( SED_EXECUTABLE sed ) -if ( GENGETOPT_EXECUTABLE AND SED_EXECUTABLE ) - message( "-- Regenerating cmdline.in" ) - # gengetopt generates cmdline.h, then we move it to cmdline.in. - execute_process( COMMAND "${GENGETOPT_EXECUTABLE}" "--input=options.ggo" - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src" ) - file( RENAME "${CMAKE_CURRENT_SOURCE_DIR}/src/cmdline.h" "${CMAKE_CURRENT_SOURCE_DIR}/src/cmdline.in" ) - # Due to a bug in gengetopt, we have to manually insert some code. - # Replace the first instance of REPLACEME with some text. - # Eight backslashes = two in the code because of how many instances of escaping is happening. - execute_process( COMMAND "${SED_EXECUTABLE}" "-i" "0,/REPLACEME/{s/REPLACEME/X=%x\\\\\\\\nY=%y\\\\\\\\nW=%w\\\\\\\\nH=%h\\\\\\\\nG=%g\\\\\\\\nID=%i\\\\\\\\nCancel=%c\\\\\\\\n/}" "cmdline.c" - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src" ) - # Then replace remaining instances. - execute_process( COMMAND "${SED_EXECUTABLE}" "-i" "s/REPLACEME/X=%x\\\\nY=%y\\\\nW=%w\\\\nH=%h\\\\nG=%g\\\\nID=%i\\\\nCancel=%c\\\\n/" "cmdline.c" - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src" ) -else() - message( "Warning: Command gengetopt or sed not found! Won't regenerate command line code. (If you're just compiling this doesn't matter.)" ) -endif() - # By default our src/options.ggo has our cmake versions variables for # the 'version ""' line. We replace them here. # The ${CMAKE_SOURCE_DIR} is there to fix problems with OpenBSD's out-of-source build black magic.