Commits

shl...@7081e830-ea04-0410-ae62-fb6148e2d9db  committed 3d557c7

Changes to get "make" after cmake .. to work.

These are various changes to get make after cmake .. (after mkdir build ; cd
../build) to work. Including various fully-qualified changes, etc.

  • Participants
  • Parent commits ae12b4a
  • Branches conversion-to-cmake

Comments (0)

Files changed (8)

File src/Common.cmake

   ENDFOREACH(name)
 ENDMACRO(CHECK_MULTI_FUNCTIONS_EXISTS)
 
-MACRO(PREPROCESS_PATH_PERL TARGET_NAME SOURCE DEST)
+MACRO(PREPROCESS_PATH_PERL_WITH_FULL_NAMES TARGET_NAME SOURCE DEST)
     ADD_CUSTOM_COMMAND(
         OUTPUT "${DEST}"
         COMMAND "${PERL_EXECUTABLE}"
         ${TARGET_NAME} ALL
         DEPENDS ${DEST}
     )
+ENDMACRO(PREPROCESS_PATH_PERL_WITH_FULL_NAMES)
+
+MACRO(PREPROCESS_PATH_PERL TARGET_NAME BASE_SOURCE BASE_DEST)
+    SET (DEST "${CMAKE_CURRENT_BINARY_DIR}/${BASE_DEST}")
+    SET (SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/${BASE_SOURCE}")
+    PREPROCESS_PATH_PERL_WITH_FULL_NAMES ("${TARGET_NAME}" "${SOURCE}" "${DEST}")
 ENDMACRO(PREPROCESS_PATH_PERL)
 
 # Copies the file from one place to the other.
     )
 ENDMACRO(ADD_COPY_TARGET)
 
-MACRO(RUN_POD2MAN TARGET_NAME SOURCE DEST SECTION CENTER RELEASE)
+MACRO(RUN_POD2MAN TARGET_NAME BASE_SOURCE BASE_DEST SECTION CENTER RELEASE)
+    SET (DEST "${CMAKE_CURRENT_BINARY_DIR}/${BASE_DEST}")
+    SET (SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/${BASE_SOURCE}")
     SET(PATH_PERL ${PERL_EXECUTABLE})
     ADD_CUSTOM_COMMAND(
-        OUTPUT ${DEST}
-        COMMAND ${PATH_PERL} 
-        ARGS "-e" 
-        "my (\$src, \$dest, \$sect, \$center, \$release) = @ARGV; my \$pod = qq{Hoola.pod}; use File::Copy; copy(\$src, \$pod); system(qq{pod2man --section=\$sect --center=\"\$center\" --release=\"\$release\" \$pod > \$dest}); unlink(\$pod)"
-        ${SOURCE}
-        ${DEST}
-        ${SECTION}
-        "${CENTER}"
-        "${RELEASE}"
+        OUTPUT "${DEST}"
+        COMMAND "${PATH_PERL}"
+        ARGS "${CMAKE_SOURCE_DIR}/cmake/pod2man-wrapper.pl"
+            "--src" "${SOURCE}"
+            "--dest" "${DEST}"
+            "--section" "${SECTION}"
+            "--center" "${CENTER}"
+            "--release" "${RELEASE}"
         DEPENDS ${SOURCE}
         VERBATIM
     )

File src/cmake/pod2man-wrapper.pl

+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Getopt::Long;
+use File::Temp qw/tempdir/;
+use File::Copy; 
+
+my ($src, $dest, $sect, $center, $release);
+
+GetOptions(
+    'src=s' => \$src,
+    'dest=s' => \$dest,
+    'section=s' => \$sect,
+    'center=s' => \$center,
+    'release=s' => \$release,
+)
+    or die "Wrong options.";
+
+if (!defined($src))
+{
+    die "src not specified.";
+}
+
+if (!defined($dest))
+{
+    die "dest not specified.";
+}
+
+if (!defined($sect))
+{
+    die "section not specified.";
+}
+
+if (!defined($center))
+{
+    die "center not specified.";
+}
+
+if (!defined($release))
+{
+    die "release not specified.";
+}
+
+my $dir = tempdir( CLEANUP => 1);
+
+my $pod = "$dir/Hoola.pod";
+copy($src, $pod); 
+
+if(
+system(
+    'pod2man',
+    "--section=$sect",
+    "--center=$center",
+    "--release=$release",
+    $pod,
+    $dest
+)
+)
+{
+    die "pod2man failed! $!";
+}

File src/wml_aux/iselect/CMakeLists.txt

 
 SIMPLE_POD2MAN(
     "wml_aux_iselect"
-    "${CMAKE_CURRENT_SOURCE_DIR}/iselect.pod"
-    "${CMAKE_CURRENT_BINARY_DIR}/iselect"
+    "iselect.pod"
+    "iselect"
     "1"
 )
 

File src/wml_backend/p3_eperl/CMakeLists.txt

 )
 
 ADD_CUSTOM_COMMAND(
-    OUTPUT "eperl.pod"
+    OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/eperl.pod"
     COMMAND "${PERL_EXECUTABLE}"
-    ARGS "eperl-pod-preproc.pl"
-        "--input" "eperl.proto.pod"
-        "--output" "eperl.pod"
-        "--versionfrom" "eperl_version.c"
-    DEPENDS "eperl-pod-preproc.pl" "eperl.proto.pod" "eperl_version.c"
+    ARGS "${CMAKE_CURRENT_SOURCE_DIR}/eperl-pod-preproc.pl"
+        "--input" "${CMAKE_CURRENT_SOURCE_DIR}/eperl.proto.pod"
+        "--output" "${CMAKE_CURRENT_BINARY_DIR}/eperl.pod"
+        "--versionfrom" "${CMAKE_CURRENT_SOURCE_DIR}/eperl_version.c"
+    DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/eperl-pod-preproc.pl" "${CMAKE_CURRENT_SOURCE_DIR}/eperl.proto.pod" "${CMAKE_CURRENT_SOURCE_DIR}/eperl_version.c"
 )
 
 ADD_CUSTOM_TARGET(

File src/wml_backend/p9_slice/CMakeLists.txt

 SET(BASENAME "slice")
 SET(src "${CMAKE_CURRENT_SOURCE_DIR}/${BASENAME}_main.pl")
-SET(intermediate "${CMAKE_CURRENT_BINARY_DIR}/${BASENAME}.pre.pl")
-SET(dest "${CMAKE_CURRENT_BINARY_DIR}/${BASENAME}.pl")
+SET(intermediatebase "${BASENAME}.pre.pl")
+SET(intermediate "${CMAKE_CURRENT_BINARY_DIR}/${intermediatebase}")
+SET(destbase "${BASENAME}.pl")
+SET(dest "${CMAKE_CURRENT_BINARY_DIR}/${destbase}")
 
 ADD_CUSTOM_COMMAND(
     OUTPUT "${intermediate}"
     DEPENDS "${intermediate}"
 )
 
-PREPROCESS_PATH_PERL(
+PREPROCESS_PATH_PERL_WITH_FULL_NAMES(
     "${BASENAME}_preproc" "${intermediate}" "${dest}"
 )
 
 SET(INST_BASE "wml_p9_${BASENAME}")
 
 INST_RENAME_POD2MAN(
-    "${BASENAME}_pod" "${dest}" "${BASENAME}" "1" "${INST_BASE}"
+    "${BASENAME}_pod" "${destbase}" "${BASENAME}" "1" "${INST_BASE}"
 )
 INSTALL(
     PROGRAMS "${dest}"

File src/wml_docs/CMakeLists.txt

 
 ENDFOREACH(MYSTD ${STDS})
 
-SET (TAGS_POD "wml_tags.pod")
+SET (TAGS_POD "${CMAKE_CURRENT_BINARY_DIR}/wml_tags.pod")
 ADD_CUSTOM_COMMAND(
     OUTPUT "${TAGS_POD}"
     COMMAND ${PERL_EXECUTABLE}
-    ARGS "wml_tags.pod.pl"
-    DEPENDS "wml_tags.pod.in" "wml_tags.L.main" "wml_tags.L.incl" 
+    ARGS "${CMAKE_CURRENT_SOURCE_DIR}/wml_tags.pod.pl"
+    DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/wml_tags.pod.in" 
+            "${CMAKE_CURRENT_SOURCE_DIR}/wml_tags.L.main"
+            "${CMAKE_CURRENT_SOURCE_DIR}/wml_tags.L.incl" 
     VERBATIM
 )
 

File src/wml_frontend/CMakeLists.txt

 MACRO(set_vars)
     SET (destbase "${cmd}.pl")
     SET (dest "${CMAKE_CURRENT_BINARY_DIR}/${destbase}")
-    SET (src "${CMAKE_CURRENT_SOURCE_DIR}/${cmd}.src")
-    SET (manname "${CMAKE_CURRENT_BINARY_DIR}/${cmd}")    
+    SET (srcbase "${cmd}.src")
+    SET (src "${CMAKE_CURRENT_SOURCE_DIR}/${srcbase}")
+    SET (mannamebase "${cmd}")
+    SET (manname "${CMAKE_CURRENT_BINARY_DIR}/${mannamebase}")
 ENDMACRO(set_vars)
 
 FOREACH (cmd wmk wml wmb wmd wmu)
         DESTINATION "bin"
         RENAME "${cmd}"
         )
-    INST_POD2MAN("${cmd}_pod" "${src}" "${manname}" "1")
+    INST_POD2MAN("${cmd}_pod" "${srcbase}" "${mannamebase}" "1")
     ADD_CUSTOM_TARGET(
         "preprocess_perl_frontend_${cmd}" ALL
         DEPENDS "${dest}"
 
 FOREACH(cmd wmd_missing)
     set_vars()
-    INST_POD2MAN("${cmd}_pod" "${src}" "${manname}" "1")
+    INST_POD2MAN("${cmd}_pod" "${srcbase}" "${mannamebase}" "1")
 ENDFOREACH(cmd)
 
 INSTALL_DATA ("wmd.txt")

File src/wml_include/CMakeLists.txt

     COPY_ONLY
 )
 
+SET (dirs_to_make )
+
 FOREACH (base ${myfiles})
+
+    # Make the directory to which the file belongs.
+    STRING (REGEX REPLACE "/.*" "" basedir "${base}")
+    LIST (FIND dirs_to_make "${basedir}" found)
+    IF ("${found}" STREQUAL "-1")
+        LIST (APPEND dirs_to_make "${basedir}")
+        FILE (MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${basedir}")
+    ENDIF ("${found}" STREQUAL "-1")
+
     SET (destbase "${base}.wml")
     SET (dest "${CMAKE_CURRENT_BINARY_DIR}/${destbase}")
-    SET (src "${CMAKE_CURRENT_SOURCE_DIR}/${base}.src")
-    SET (manname "${CMAKE_CURRENT_BINARY_DIR}/${base}")
+    SET (srcbase "${base}.src")
+    SET (src "${CMAKE_CURRENT_SOURCE_DIR}/${srcbase}")
+    SET (mannamebase "${base}")
+    SET (manname "${CMAKE_CURRENT_BINARY_DIR}/${mannamebase}")
 
     STRING (REPLACE "/" "__" target_base "${base}")
 
 
     INST_RENAME_POD2MAN(
         "include_${target_base}_pod"
-        "${src}"
-        "${manname}"
+        "${srcbase}"
+        "${mannamebase}"
         "3"
         "${dest_man}"
     )