On Fri, Jan 24, 2020 at 7:31 AM Ruben Van Boxem <vanboxem.rube
> In my eyes, your CMakeLists.txt shouldn't contain a hardcoded Unix path
> such as /tmp. Instead it should e.g. check if it exists and accept a
> parameter from the command line to overwrite this using an option. In this
> case, it is much more conventional (and it will probably work better
> already) if you pass CMAKE_INSTALL_PREFIX from the command line.
>
> Additionally, directly calling unix commands within a CMakeLists.txt is
> also suboptimal. Instead you should call cmake -E (replace "cmake" with the
> variable CMake defines for itself) followed by the appropriate command you
> want to execute.
>
> Lastly, if the path issue is really getting in your way, you could try
> calling/building/using an MSYS2 version of CMake. I'm not sure there is a
> ready-made package for it, and in light of the above options, I don't think
> this will really be necessary.
>
> Ruben
>
> While the file creation actions went into C:/tmp, after doing this:
> >
> > >>
> > >> mkdir /tmp/testinstall
> > >> mkdir /tmp/testinstall/bin
> > >> mkdir /tmp/testinstall/man
> > >> cmake -G "MSYS Makefiles" ..
> > >> make

in addition, i prefer cross compile cmake-based projects instead, even
in MSYS2. you must open the MinGW 64 bits shell to cross compile for
64 bits :

----- cross.txt -----

set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR AMD64)
set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
set(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)

----- end of cross.txt -----

cmake -DCMAKE_TOOLCHAIN_FILE=cross.txt -G "Unix Makefiles" ....

Vincent Torri

> > the binaries and man files were all correctly deposited into
> > /tmp/testinstall, not C:\tmp\testinstall.  If this was a bash script I
> > would know how to handle this, but within cmake I don't.  Skipping all
> > the compile stuff look at this subsection:
> >
> > SET(CMAKE_INSTALL_PREFIX "/tmp/testinstall")
> > SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_INSTALL_PREFIX}/bin)
> > SET(MAN_INSTALL_DIR  ${CMAKE_INSTALL_PREFIX}/man/man1)
> >
> > FILE(MAKE_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
> > if (DO_MAN)
> >         FILE(GLOB MAN_FILES  "${CMAKE_CURRENT_SOURCE_DIR}/*.1")
> >         FILE(MAKE_DIRECTORY ${MAN_INSTALL_DIR})
> >         #install man pages
> >         ADD_CUSTOM_TARGET(man ALL
> >                 ${CMAKE_COMMAND} -E copy  ${MAN_FILES} ${MAN_INSTALL_DIR}
> >                 COMMENT "Copying all man pages")
> > endif (DO_MAN)
> >
> > The MAKE_DIRECTORY for ${MAN_INSTALL_DIR} went to C:\tmp\testinstall\man
> > and the CMAKE_COMMAND -E copy went to /tmp/testinstall/man.  I think
> > what is happening
> > here is that when the CMAKE_COMMAND (or a compiler action) is done cmake
> > actually spins out
> > a bash session and runs the command line within that, so the usual
> > cygwin to windows path conversions are performeds.  But
> > FILE(MAKE_DIRECTORY...) is internal to cmake and it probably does a
> > mkdir() call directly, so the conversions are not made.
> >
> > Suggestions for making this portable????
> >
> > Thanks,
> >
> > David Mathog
> > mat...@caltech.edu
> > Manager, Sequence Analysis Facility, Biology Division, Caltech
> >
> >
> > _______________________________________________
> > Mingw-w64-public mailing list
> > Mingw-w64-public@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
> >
>
> _______________________________________________
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to