The easiest way to include 3rd party libs is often to put the sources into 
your project source tree and compile them as part of the project, since 
you'd need to compile the Google Test code to an emscripten / LLVM static 
link lib anyway.

If you want to do the latter (use Google Test code as emscripten static 
precompiled lib), I'd suggest not using FIND_PACKAGE, but instead copy the 
emscripten/LLVM .a bitcode files (which you need to compile yourself) into 
a lib subdirectory of your project, and add this directory to the library 
search path with cmake's "link_directories" command.

You can also check my cmake build system here, but this might be a bit of 
overkill:

https://github.com/floooh/oryol/tree/master/cmake

Cheers,
-Floh.

Am Montag, 16. Juni 2014 20:05:08 UTC+2 schrieb [email protected]:
>
> Hello, I decided to use CMake for my project because the emscripten kind 
> of suggested it (but if something else is better, I can change).
> I wanted to use gtest (Google Test), so I added the following lines to my 
> CMakeLists.txt, which worked well when producing native binaries
>
>     FIND_PACKAGE(GTest REQUIRED)
>     INCLUDE_DIRECTORIES(${GTEST_INCLUDE_DIRS})
>     TARGET_LINK_LIBRARIES(test ${GTEST_LIBRARIES})
>
> Where should I install gtest (i.e. what should I write in --prefix) if I 
> want cmake to find it when using emscripten? I tried putting them in 
> "$EMSCRIPTEN"/system/{include,lib}, but that didn't work. I'm using this to 
> run emscripten
>
>     cmake -G "Unix Makefiles" 
> -DCMAKE_TOOLCHAIN_FILE="$EMSCRIPTEN"/cmake/Platform/Emscripten.cmake
>
> Also is it possible to make FIND_PACKAGE(SDL) work/do nothing? Now I had 
> to comment it out like this, but I think it would be best if one could use 
> the same CMakeLists.txt when producing native binaries and javascript!
>
>     IF (NOT DEFINED EMSCRIPTEN)
>         FIND_PACKAGE(SDL REQUIRED)
>         INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR})
>         TARGET_LINK_LIBRARIES(test ${SDL_LIBRARY})
>     ENDIF()
>
> Thank you!
> Stevie Trujillo
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to