Commits

Shlomi Fish  committed 3f469ca

Got "make install" to work inside ./build ; cmake ...

Fixed many bugs with the CMake configuration.

  • Participants
  • Parent commits 65739ba
  • Branches conversion-to-cmake

Comments (0)

Files changed (7)

File src/Common.cmake

 
 MACRO(INST_POD2MAN TARGET_NAME SOURCE DEST SECTION)
    SIMPLE_POD2MAN ("${TARGET_NAME}" "${SOURCE}" "${DEST}" "${SECTION}")
-   INSTALL_MAN ("${DEST}.${SECTION}" "${SECTION}")
+   INSTALL_MAN ("${CMAKE_CURRENT_BINARY_DIR}/${DEST}.${SECTION}" "${SECTION}")
 ENDMACRO(INST_POD2MAN)
 
 MACRO(INST_RENAME_POD2MAN TARGET_NAME SOURCE DEST SECTION INSTNAME)
    SIMPLE_POD2MAN ("${TARGET_NAME}" "${SOURCE}" "${DEST}" "${SECTION}")
-   INSTALL_RENAME_MAN ("${DEST}.${SECTION}" "${SECTION}" "${INSTNAME}")
+   INSTALL_RENAME_MAN ("${DEST}.${SECTION}" "${SECTION}" "${INSTNAME}" "${CMAKE_CURRENT_BINARY_DIR}")
 ENDMACRO(INST_RENAME_POD2MAN)
 
 # Finds libm and puts the result in the MATH_LIB_LIST variable.
     )
 ENDMACRO(INSTALL_DATA)
 
-MACRO(INSTALL_RENAME_MAN SOURCE SECTION INSTNAME)
+MACRO(INSTALL_RENAME_MAN SOURCE SECTION INSTNAME MAN_SOURCE_DIR)
     INSTALL(
         FILES
-            "${SOURCE}"
+            "${MAN_SOURCE_DIR}/${SOURCE}"
         DESTINATION
             "share/man/man${SECTION}"
         RENAME
 MACRO(INSTALL_CAT_MAN SOURCE SECTION)
     INSTALL(
         FILES
-            ${SOURCE}
+            "${CMAKE_CURRENT_BINARY_DIR}/${SOURCE}"
         DESTINATION
             "share/man/cat${SECTION}"
     )
 MACRO(DEFINE_WML_AUX_PERL_PROG_WITHOUT_MAN BASENAME)
     PREPROCESS_PATH_PERL("preproc_${BASENAME}" "${BASENAME}.src" "${BASENAME}.pl")
     INSTALL(
-        PROGRAMS "${BASENAME}.pl"
+        PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/${BASENAME}.pl"
         DESTINATION "${WML_LIBEXE_DIR}"
         RENAME "wml_aux_${BASENAME}"
     )
 MACRO(DEFINE_WML_AUX_PERL_PROG BASENAME)
     DEFINE_WML_AUX_PERL_PROG_WITHOUT_MAN("${BASENAME}")
     RUN_POD2MAN("pod_${BASENAME}" "${BASENAME}.src" "${BASENAME}.1" "1" "EN  Tools" "En Tools")
-    INSTALL_RENAME_MAN ("${BASENAME}.1" 1 "wml_aux_${BASENAME}")
+    INSTALL_RENAME_MAN ("${BASENAME}.1" 1 "wml_aux_${BASENAME}" "${CMAKE_CURRENT_BINARY_DIR}")
 ENDMACRO(DEFINE_WML_AUX_PERL_PROG BASENAME)
 
 MACRO(DEFINE_WML_AUX_C_PROG_WITHOUT_MAN BASENAME)
     )
 ENDMACRO(DEFINE_WML_AUX_C_PROG_WITHOUT_MAN BASENAME)
 
-MACRO(DEFINE_WML_AUX_C_PROG BASENAME)
+MACRO(DEFINE_WML_AUX_C_PROG BASENAME MAN_SOURCE_DIR)
     DEFINE_WML_AUX_C_PROG_WITHOUT_MAN (${BASENAME} ${ARGN})
-    INSTALL_RENAME_MAN ("${BASENAME}.1" 1 "wml_aux_${BASENAME}")
+    INSTALL_RENAME_MAN ("${BASENAME}.1" 1 "wml_aux_${BASENAME}" "${MAN_SOURCE_DIR}")
 ENDMACRO(DEFINE_WML_AUX_C_PROG BASENAME)
 
 MACRO(DEFINE_WML_PERL_BACKEND BASENAME DEST_BASENAME)
         "${DEST_BASENAME}"
     )
     INSTALL(
-        PROGRAMS "${BASENAME}.pl"
+        PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/${BASENAME}.pl"
         DESTINATION "${WML_LIBEXE_DIR}"
         RENAME "${DEST_BASENAME}"
     )    

File src/wml_aux/iselect/CMakeLists.txt

 
 DEFINE_WML_AUX_C_PROG (
    "iselect"
+   "${CMAKE_CURRENT_BINARY_DIR}"
    iselect_main.c iselect_browse.c iselect_keys.c
    iselect_getopt.c iselect_version.c iselect_help.c iselect_readme.c
 )

File src/wml_aux/tidy/CMakeLists.txt

 SET (html "Overview.html")
 SET (man "wml_aux_tidy.1")
 ADD_CUSTOM_COMMAND(
-    OUTPUT "${man}"
+    OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${man}"
     COMMAND "lynx"
     ARGS "-dump" "-nolist" "-width=72" "${html}" ">" "${man}"
     DEPENDS "${html}"

File src/wml_aux/weblint/CMakeLists.txt

 DEFINE_WML_AUX_PERL_PROG_WITHOUT_MAN("weblint")
 
-INSTALL_RENAME_MAN("weblint.1" 1 "wml_aux_weblint")
+INSTALL_RENAME_MAN("weblint.1" 1 "wml_aux_weblint" "${CMAKE_CURRENT_SOURCE_DIR}")
 
 INSTALL_DATA("weblintrc")

File src/wml_backend/p3_eperl/CMakeLists.txt

 )
 
 SET(SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/eperl_perl5_sm.pl")
-SET(HEADER "${CMAKE_CURRENT_SOURCE_DIR}/eperl_perl5_sm.h")
+SET(HEADER "${CMAKE_CURRENT_BINARY_DIR}/eperl_perl5_sm.h")
 ADD_CUSTOM_COMMAND(
     OUTPUT ${HEADER}
     COMMAND ${PATH_PERL}
-    ARGS ${SCRIPT}
+    ARGS "${SCRIPT}" "-o" "${HEADER}"
     DEPENDS ${SCRIPT}
     VERBATIM
 )

File src/wml_backend/p3_eperl/eperl_perl5_sm.pl

 ##
 
 use Config;
+use Getopt::Long;
 
-open O, ">eperl_perl5_sm.h";
+my $output_fn;
+GetOptions(
+    'o|output=s' => \$output_fn,
+) or die "Output not specified. $!";
+
+if (!defined($output_fn))
+{
+    die "Output not specified.";
+}
+
+open O, '>', $output_fn
+    or die "Cannot open '$output_fn' for writing";
 select(O);
 print <<'EOT'
 /*

File src/wml_docs/CMakeLists.txt

     SET (TXT_SRC "${MYSTD}.txt")
     SET (MAN7_LOCAL "${MYSTD}.7")
 
-    ADD_COPY_TARGET("std_copy_${MYSTD}" "${TXT_SRC}" "${MAN7_LOCAL}")
+    # MESSAGE (FATAL_ERROR "${CMAKE_CURRENT_BINARY_DIR}/${MAN7_LOCAL}")
+    ADD_COPY_TARGET("std_copy_${MYSTD}" "${CMAKE_CURRENT_SOURCE_DIR}/${TXT_SRC}" "${CMAKE_CURRENT_BINARY_DIR}/${MAN7_LOCAL}")
 
     INSTALL_CAT_MAN("${MAN7_LOCAL}" "7")
 
 ENDFOREACH(MYSTD ${STDS})
 
-SET (TAGS_POD "${CMAKE_CURRENT_SOURCE_DIR}/wml_tags.pod")
+# MESSAGE (FATAL_ERROR "CUR_BIN = ${CMAKE_CURRENT_BINARY_DIR}")
+SET (TAGS_POD "${CMAKE_CURRENT_BINARY_DIR}/wml_tags.pod")
 ADD_CUSTOM_COMMAND(
     OUTPUT "${TAGS_POD}"
     COMMAND ${PERL_EXECUTABLE}
     SET (POD_SRC "${MYDOC}.pod")
     SET (MAN_LOCAL "${MYDOC}")
 
+    IF (${MYDOC} STREQUAL "wml_tags")
+        SET (POD2MAN_SOURCE_IS_IN_BINARY 1)
+    ENDIF (${MYDOC} STREQUAL "wml_tags")
     INST_POD2MAN("wml_doc_${MYDOC}_pod" "${POD_SRC}" "${MAN_LOCAL}" "7")
 ENDFOREACH(MYDOC ${WML_DOCS})