OS/2, eCS & ArcaOS - Technical > Programming

CMake

(1/3) > >>

david.oakford:
How do I indicate to CMake that an executable is a PM (WINDOWAPI) program.
Is there a keyword for the add_executable(targetName [WIN32] [?WINDOWAPI | PM?]
I took one of Martin's Sample programs, vectfont, created a CMakeLists.txt file. 
It configured successfully and the make worked, producing an executable, but it doesn't run.

Martin Iturbide:
Hello David

Welcome to the forum !!! After all those years meeting at Warpstock, I'm glad you are here on the OS2World forum.

Maybe it can be interesting (if you want) to post the sample and CMakeLists.txt file here as an attachment to the forum (as a zip file).

My thoughts are:
1) If you run the executable (vectfont.exe) on a OS/2 command line, what errors does it gives you?
2) For what I have learn the "WINDOWAPI" app type is set on the .DEF file
          NAME           VECTFONT  WINDOWAPI
But maybe here someone with more experience can reply that.

Regards

Dave Yeo:
From @unixroot\usr\share\cmake\Modules\Platform\OS2.cmake
...

--- Code: ---# With the TARGET_SHORT you can create a shorter name for the dll
#
# The 2 settings with OS2_DEF_EXE_ are for executables only.
# Usually the Stack value is not needed, so omit it please.
#
# if(OS2)
#   set_target_properties(<TARGET> PROPERTIES
#    OS2_DEF_VENDOR "whoever you are"
#    OS2_DEF_PATCH "${VERSION_PATCH}"
#    OS2_DEF_VERSION "${VERSION}"
#    TARGET_SHORT shortn
#    OS2_DEF_EXEType "WINDOWAPI"
#    OS2_DEF_EXEStack "STACKSIZE 0x8000")
# endif()
#

--- End code ---
...
includes stuff for bldlevel.
Edit: Typo

david.oakford:
David,
Thanks. I will give it a try in the morning.
David

david.oakford:
Thanks David Yeo.

This is what finally worked. 
That OS2.cmake file had  the clues.
In addition to the stuff that added the necessary info to the .def file,
some more is needed to get the rc file compiled and included.

This is the CMakeLists.txt file:

cmake_minimum_required(VERSION 3.15)
project(vectfont)
add_executable(vectfont
    vectfont.c
    vf00.c
    vf01.c
    vf02.c
    vf03.c
    vf04.c
    vf05.c
    vf06.c
    vf07.c
    vf08.c
    vf09.c
    vf10.c
    vf11.c
    vf12.c
    vf13.c
    vf14.c
    vf15.c
    vectfont.rc
)
if(OS2)
  enable_language(RC)
  set_source_files_properties(vectfont.rc PROPERTIES LANGUAGE RC)
  set(project_SOURCES ${project_SOURCES}
   vectfont.rc
  )
  set_target_properties(vectfont PROPERTIES
   OS2_DEF_VENDOR "oakford"
   OS2_DEF_PATCH "${VERSION_PATCH}"
   OS2_DEF_VERSION "${VERSION}"
   OS2_DEF_EXEType "WINDOWAPI"
  )
endif()


Then run this in the directory with the source code and CMakeLists.txt file:
cmake  -B build
cmake --build build
It will create the exe in the build  subdirectory.

This really helps.

David

Navigation

[0] Message Index

[#] Next page

Go to full version