3

I want to build an executable with an icon. By googling it, I find the instruction here, but it only works by compiling a source file with ghc.

If I want to build a project with an executable by cabal build or stack build, how should I configure the .cabal or .yaml files such that cabal build or stack build can directly create an executable with an icon?

I've googled it for a while, but nothing useful.

I appreciate it if any tips are given.

Z-Y.L
  • 1,740
  • 1
  • 11
  • 15

1 Answers1

2

According to @Willem Van Onsem's suggestion, the following is the solution:

  • for a stack project, add the following configure into the stack.yaml file
    ghc-options:

        "$targets": Icon.o
  • for a cabal project, add the following ghc-options into the .cabal file
    ghc-options:

        Icon.o
Z-Y.L
  • 1,740
  • 1
  • 11
  • 15
  • I have problem creating the Icon.o file. Winres give me syntax error. My post : https://stackoverflow.com/questions/65095586/syntax-error-when-running-winres-trying-to-set-executable-icon – Johannes Green Dec 01 '20 at 18:35